<template>
  <pageTabelLayout v-loading="contentLoading">
    <template #pageHeader>
      <div>
        <div class="search-form" v-if="headerShow">
          <a-form size="small" :model="pageData" layout="inline">
            <a-form-item :style="{ width: '280px' }" label-col-flex="100px" label="织布单号">
              <a-input
                allow-clear
                :style="{ width: '250px' }"
                class="bacClass"
                placeholder=""
                v-model="pageData.jhXh"
                @press-enter="huiche"
              />
            </a-form-item>
            <a-form-item :style="{ width: '280px' }" label-col-flex="100px" label="客户订单号">
              <a-input
                allow-clear
                :style="{ width: '250px' }"
                class="bacClass"
                placeholder=""
                v-model="pageData.pbXh"
                @press-enter="huiche"
              />
            </a-form-item>
            <a-form-item :style="{ width: '280px' }" label-col-flex="100px" label="客户">
              <a-input
                allow-clear
                :style="{ width: '250px' }"
                class="bacClass"
                placeholder=""
                v-model="pageData.bmXh"
                @press-enter="huiche"
              />
            </a-form-item>
            <a-form-item :style="{ width: '280px' }" label-col-flex="100px">
              <template #label> 确认状态</template>
              <a-select
                popup-container="html"
                class="bacClass"
                @clear="pageData.shZt = ''"
                :style="{ width: '200px' }"
                v-model="pageData.shZt"
                allow-clear
                allow-search
                @change="state()"
              >
                <a-option :value="1">已提交</a-option>
                <a-option :value="0">未提交</a-option>
              </a-select>
            </a-form-item>
            <CorporateSectorCascader
              ref="cascaderRef3"
              v-if="active != 2"
              :configCascader="configCascader3"
              @changeCascader="changeCascader3"
            />
          </a-form>
        </div>
      </div>
      <div class="my-divisders">
        <a-divider orientation="center">
          <icon-double-up
            v-if="headerShow"
            @click="headerShow = false"
            :strokeWidth="2"
            :size="18"
          />
          <icon-double-down v-else @click="headerShow = true" :strokeWidth="2" :size="18" />
        </a-divider>
      </div>
      <div class="my-tool-bar">
        <Toolbar
          :items="itemsList"
          @select="selectHandler"
          @add="addHandler"
          @del="deleteHandler"
          @tj="shenghe"
          @qxtj="fShen"
          @export="exportsz"
          @complete="completes"
          @ChangeButton="ChangeButton"
          v-show="active == 2"
          @zbtzd="ZBprint"
          @zbtzdDj="zbtzdDjs"
          @exportAll="exportAll"
        >
        </Toolbar>
        <Toolbar :items="itemsList1" @select="getList" @tj="submit" v-show="active == 0"></Toolbar>
        <Toolbar
          :items="itemsList2"
          @select="getList"
          @printWjg="printPdf"
          @printBgd="printBgds"
          v-show="active == 1"
        ></Toolbar>
      </div>
    </template>
    <template #pageTabel>
      <a-tabs
        :lazy-load="true"
        :justify="true"
        :default-active-key="active"
        @change="activeChange($event)"
      >
        <a-tab-pane title="织布单列表" key="2">
          <a-spin
            :loading="pageData.pageLoading"
            tip="加载中"
            dot
            style="height: 100%; width: 100%; z-index: 999"
          >
            <AgGridVuesCopys
              :rowHeight="33"
              :headerHeight="33"
              :suppressCopyRowsToClipboard="true"
              :suppressDragLeaveHidesColumns="true"
              rowSelection="multiple"
              @grid-ready="gridReady"
              @columnResized="onColumnResized"
              @columnMoved="onColumnMoved"
              @columnVisible="onColumnVisible"
              style="height: calc(100% - 45px)"
              :defaultColDef="defaultColDef"
              class="ag-theme-alpine"
              :rowData="table.dataList"
              :columnDefs="tc"
              :localeText="localeText1"
            ></AgGridVuesCopys>
            <paginationCopys
              :page-size-options="pagingList1"
              :total="total"
              show-total
              show-jumper
              show-page-size
              @change="PageSize"
              @page-size-change="change1"
              style="justify-content: center; margin-top: 10px"
              :page-size="pagination.pageSize"
              :current="pagination.page"
            />
          </a-spin>
        </a-tab-pane>
        <a-tab-pane title="织布单更改待处理" key="0">
          <a-spin
            :loading="pageData.pageLoading"
            tip="加载中"
            dot
            style="height: 100%; width: 100%; z-index: 999"
          >
            <AgGridVuesCopys
              :rowHeight="33"
              :headerHeight="33"
              :suppressCopyRowsToClipboard="true"
              :suppressDragLeaveHidesColumns="true"
              rowSelection="multiple"
              @grid-ready="gridReady1"
              @columnResized="onColumnResized2"
              @columnMoved="onColumnMoved2"
              @columnVisible="onColumnVisible2"
              style="height: calc(100% - 45px)"
              :defaultColDef="defaultColDef"
              class="ag-theme-alpine"
              :rowData="dataList"
              :columnDefs="Columns"
              :localeText="localeText"
            ></AgGridVuesCopys>
            <paginationCopys
              :page-size-options="pagingList1"
              :total="total"
              show-total
              show-jumper
              show-page-size
              @change="PageSize"
              @page-size-change="change1"
              style="justify-content: center; margin-top: 10px"
              :page-size="paginationA1.pageSize"
              :current="paginationA1.page"
            />
          </a-spin>
        </a-tab-pane>
        <a-tab-pane title="织布单更改已处理" key="1">
          <a-spin
            :loading="pageData.pageLoading"
            tip="加载中"
            dot
            style="height: 100%; width: 100%; z-index: 999"
          >
            <AgGridVuesCopys
              :rowHeight="33"
              :headerHeight="33"
              :suppressCopyRowsToClipboard="true"
              :suppressDragLeaveHidesColumns="true"
              rowSelection="multiple"
              @grid-ready="gridReadyasda"
              @columnResized="onColumnResized3"
              @columnMoved="onColumnMoved3"
              @columnVisible="onColumnVisible3"
              style="height: calc(100% - 45px)"
              :defaultColDef="defaultColDef"
              class="ag-theme-alpine"
              :rowData="dataList"
              :columnDefs="Columns1"
              :localeText="localeText"
              @click="clickRow"
            ></AgGridVuesCopys>
            <paginationCopys
              :page-size-options="pagingList1"
              :total="total"
              show-total
              show-jumper
              show-page-size
              @change="PageSize"
              @page-size-change="change1"
              style="justify-content: center; margin-top: 10px"
              :page-size="paginationA1.pageSize"
              :current="paginationA1.page"
            />
          </a-spin>
        </a-tab-pane>
      </a-tabs>
    </template>
    <!-- 新增弹窗 -->
    <a-drawer
      style="z-index: 999"
      ok-text="保存"
      cancel-text="关闭"
      :style="{ zIndex: 999 }"
      height="100%"
      :mask-closable="false"
      popup-container=".table-page-body"
      placement="bottom"
      :visible="pageData.showAdd"
      unmountOnClose
      @ok="sideOk"
      @cancel="sideNo"
      :closable="false"
    >
      <template #title>
        {{ pageData.sideTitle }}
      </template>
      <!-- <a-spin :loading="loadings" tip="加载中" style="width: 100%;"> -->

      <!-- <div style="width:1540px;overflow:auto;marginTop:20px;" class="scrollbar"> -->

      <div v-loading="addLoding" style="min-width: 1300px; overflow: auto">
        <a-form ref="formRef" :model="dataForm" size="mini">
          <!-- <a-collapse :default-active-key="[1]"> -->
          <!-- <a-collapse-item header="业务信息" :key="1"> -->
          <a-row :gutter="16">
            <!-- <a-col :span="6">
                                    <a-form-item label="计划单号" field="planOrderCode" label-col-flex="100px">
                                        <a-input disabled v-model="dataForm.planOrderCode" />
                                    </a-form-item>
                                </a-col> -->
            <a-col :span="6">
              <a-form-item label="织布单号" field="weavClothCode" label-col-flex="100px">
                <a-input class="bacClass" disabled v-model="dataForm.weavClothCode" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                label="是否本集团"
                label-col-flex="100px"
                :rules="[{ required: true, message: '是否本集团必填' }]"
                :validate-trigger="['change', 'blur']"
              >
                <a-select
                  popup-container="html"
                  allow-clear
                  class="bacClass"
                  v-model="dataForm.processType"
                  @change="changeProcessType"
                  disabled
                >
                  <a-option :value="0">本集团</a-option>
                  <a-option :value="1">外加工</a-option>
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item label="客户订单号" field="customOrderNo" label-col-flex="100px">
                <a-input class="bacClass" v-model="dataForm.customOrderNo" />
              </a-form-item>
            </a-col>
            <!-- <a-col :span="6">
                                <a-form-item label="织布编号" field="weavClothCode">
                                    <a-input class="bacClass" placeholder="请输入织布单号" v-model="dataForm.weavClothCode" />
                                </a-form-item>
                            </a-col> -->
            <a-col :span="6">
              <a-form-item
                label="客户名称"
                field="customName"
                label-col-flex="100px"
                :rules="[{ required: true, message: '客户名称必填' }]"
                :validate-trigger="['change', 'blur']"
              >
                <a-select
                  popup-container="html"
                  class="bacClass"
                  allow-clear
                  allow-search
                  @click="khmcSelect('')"
                  @search="khmcSelect($event)"
                  v-model="dataForm.customName"
                >
                  <a-option v-for="kh in khmclist" :value="kh['brandName']">
                    {{ kh['brandName'] }}
                  </a-option>
                </a-select>
              </a-form-item>
            </a-col>
          </a-row>
          <a-row :gutter="16">
            <a-col :span="6">
              <a-form-item label="是否急单" label-col-flex="100px">
                <!-- <a-input class="bacClass" placeholder="请输入订单性质" v-model="dataForm.orderNature" /> -->
                <!-- <a-select popup-container="html"  class="bacClass" allow-clear allow-search
                                            v-model="dataForm.orderNature" @click="dingdanFun">
                                            <a-option v-for="item in dingdanArrays">{{item.detailName}}</a-option>
                                        </a-select> -->
                <a-checkbox v-model="checked"></a-checkbox>
              </a-form-item>
            </a-col>
            <!-- <a-col :span="6">
                                    <a-form-item label="业务部门" field="businessDepartment" label-col-flex="100px">

                                        <a-cascader class="bacClass" v-model="dataForm.businessDepartmentId"
                                            :options="firmLists" @focus="getFirmGroup" @change="getFirmGroupsz"
                                            allow-clear />
                                    </a-form-item>
                                </a-col>
                                <a-col :span="6">
                                    <a-form-item label="业务员" field="businessPerson" label-col-flex="100px">
                                        <a-select popup-container="html"  class="bacClass" v-model="dataForm.businessPerson" @click="getYgName"
                                            :filter-option="false" allow-search allow-clear>
                                            <a-option v-for="(item, index) in ygNameList" :key="index">
                                                {{ item["empName"] }}
                                            </a-option>
                                        </a-select>

                                    </a-form-item>
                                </a-col> -->
            <a-col :span="6">
              <a-form-item
                label="织单类型"
                field="businessType"
                label-col-flex="100px"
                :rules="[{ required: true, message: '织单类型必填' }]"
                :validate-trigger="['change', 'blur']"
              >
                <!-- <a-input class="bacClass" v-model="dataForm.businessType" /> -->
                <a-select
                  popup-container="html"
                  class="bacClass"
                  allow-clear
                  allow-search
                  v-model="dataForm.businessType"
                  @click="ywFun('')"
                  @search="ywFun($event)"
                >
                  <a-option v-for="item in ywArrays">{{ item.weaveOrderType }}</a-option>
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                label="制版费"
                field="makeEditionCost"
                label-col-flex="100px"
                :rules="[{ required: true, message: '必填' }]"
                :validate-trigger="['change', 'blur']"
              >
                <a-input-number
                  class="bacClass"
                  v-model="dataForm.makeEditionCost"
                  :precision="2"
                  :min="0"
                />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                label="指令重量"
                field="orderWeight"
                :rules="[
                  {
                    type: 'number',
                    required: true,
                    max: 9999999999,
                    min: 0,
                    message: '输入不合法',
                  },
                ]"
                :validate-trigger="['change']"
                label-col-flex="100px"
              >
                <a-input-number
                  v-if="!Number.isInteger(dataForm.orderWeight)"
                  class="bacClass"
                  style="background: white !important"
                  @change="orderWeights"
                  v-model="dataForm.orderWeight"
                  @blur="blurOrderWeights"
                  :step="1"
                  :precision="2"
                >
                  <template #append>
                    <span style="width: 30px"> KG</span>
                  </template>
                </a-input-number>
                <a-input-number
                  v-else
                  class="bacClass"
                  style="background: white !important"
                  @change="orderWeights"
                  v-model="dataForm.orderWeight"
                  @blur="blurOrderWeights"
                  :step="1"
                  :precision="0"
                >
                  <template #append>
                    <span style="width: 30px"> KG</span>
                  </template>
                </a-input-number>
              </a-form-item>
            </a-col>
          </a-row>
          <a-row :gutter="16">
            <a-col :span="6">
              <a-form-item
                label="公斤/匹"
                field="pieceWeight"
                :rules="[
                  {
                    type: 'number',
                    required: true,
                    max: 9999999999,
                    min: 0,
                    message: '输入不合法',
                  },
                ]"
                :validate-trigger="['change']"
                label-col-flex="100px"
              >
                <a-input-number
                  class="bacClass"
                  @change="isTy"
                  v-model="dataForm.pieceWeight"
                  :step="1"
                  :precision="2"
                >
                </a-input-number>
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                label="匹数"
                :rules="[
                  {
                    type: 'number',
                    required: true,
                    max: 9999999999,
                    min: 0,
                    message: '输入不合法',
                  },
                ]"
                :validate-trigger="['change']"
                label-col-flex="100px"
              >
                <a-input-number
                  class="bacClass"
                  v-model="dataForm.pieceNum"
                  @change="isPs"
                  :step="1"
                  :precision="0"
                >
                </a-input-number>
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item label="加工单价" field="price" label-col-flex="100px">
                <!-- @change="isDj" -->
                <!-- <a-input v-model="dataForm.price" class="bacClass"  /> -->
                <a-input-number
                  v-model="dataForm.price"
                  @change="isDj"
                  :step="0.01"
                  :min="0"
                  :precision="0"
                  class="bacClass"
                />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item label="金额" field="amount" label-col-flex="100px">
                <a-input-number disabled v-model="dataForm.amount" class="bacClass" :precision="2">
                </a-input-number>
              </a-form-item>
            </a-col>
          </a-row>
          <a-row :gutter="16">
            <a-col :span="6">
              <a-form-item label="开单日期" field="planDate" label-col-flex="100px">
                <a-input disabled v-model="dataForm.planDate" class="bacClass" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item label="开单人" field="tabulationPerson" label-col-flex="100px">
                <a-input disabled v-model="dataForm.tabulationPerson" class="bacClass" />
              </a-form-item>
            </a-col>
            <!-- <a-col :span="6">
                                <a-form-item label="化料时间" field="chemicalTime">
                                    <a-input class="bacClass" placeholder="请输入化料时间" v-model="dataForm.chemicalTime" />
                                </a-form-item>
                            </a-col> -->
            <a-col :span="6">
              <a-form-item
                label="坯布编号"
                field="greyCode"
                label-col-flex="100px"
                :rules="[{ required: true, message: '必填' }]"
                :validate-trigger="['change', 'blur']"
              >
                <a-select
                  popup-container="html"
                  class="bacClass"
                  @click="changes1('')"
                  @search="changes1($event)"
                  @change="changes11"
                  v-model="dataForm.greyCode"
                  allow-clear
                  allow-search
                >
                  <a-option v-for="item in isDatasListMap" :value="item.greyCode"
                    >{{ item.greyCode + ' —— ' + item.grayFabricName }}
                  </a-option>
                </a-select>
                <!-- <a-input disabled v-model="dataForm.greyCode"></a-input> -->
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item label="客户坯布编号" field="outsideGreigeCode" label-col-flex="100px">
                <a-input disabled v-model="dataForm.outsideGreigeCode" class="bacClass"></a-input>
              </a-form-item>
            </a-col>
          </a-row>
          <!-- </a-collapse-item> -->
          <!-- <a-collapse-item header="计划单信息" :key="2"> -->
          <a-row :gutter="16">
            <!-- <a-col :span="6">
                                    <a-form-item label="织造序号" field="weaveCode" label-col-flex="100px">
                                        <a-input disabled v-model="dataForm.weaveCode" />
                                    </a-form-item>
                                </a-col> -->
            <a-col :span="12">
              <a-form-item
                label="坯布名称"
                field="greyName"
                label-col-flex="100px"
                :rules="[{ required: true, message: '输入坯布名称' }]"
                :validate-trigger="['change']"
              >
                <!-- <a-select popup-container="html"  class="bacClass" disabled @change="changes" :style="{ width: '640px' }" :loading="loading" allow-clear
                  allow-search @search="handleSearch" v-model="dataForm.greyName" :filter-option="false"
                  @focus="focusSel">
                  <a-option v-for="item in pageData.clothList" :value="item.grayFabricName">{{ item.grayFabricName }}
                  </a-option>
                </a-select> -->
                <a-select
                  popup-container="html"
                  class="bacClass"
                  disabled
                  :style="{ width: '640px' }"
                  :loading="loading"
                  allow-clear
                  allow-search
                  @search="handleSearch"
                  v-model="dataForm.greyName"
                  :filter-option="false"
                  @focus="focusSel"
                >
                  <a-option v-for="item in pageData.clothList" :value="item.grayFabricName"
                    >{{ item.grayFabricName }}
                  </a-option>
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item label="坯布批号" field="greyBatchNo" label-col-flex="100px">
                <!-- <a-input-group @change="changePb" v-model="dataForm.greyBatchNo"> -->
                <!-- <a-input @change="changes2" v-model="pibuArray.pibu1" />
                                        <span>-</span>
                                        <a-input @change="changes3" v-model="pibuArray.pibu2" /> -->
                <!-- </a-input-group> -->
                <!-- dataForm.greyBatchNo -->
                <a-input class="bacClass" v-model="dataForm.greyBatchNo" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item label="针寸数" label-col-flex="100px">
                <a-input disabled v-model="dataForm.workDrum" class="bacClass"></a-input>
              </a-form-item>
            </a-col>
          </a-row>
          <!-- <a-row :gutter="16"> -->
          <!-- <a-col :span="6">
                                    <a-form-item label="纱支" field="yarnCount" label-col-flex="100px">
                                        <a-select popup-container="html"  class="bacClass" :style="{ width: '320px' }" :loading="loadingr"
                                            allow-clear allow-search @search="handleSearchr" v-model="dataForm.yarnCount"
                                            :filter-option="false" @focus="focusSelr">
                                            <a-option v-for="item in pageData.clothListr" :value="item.typeName">{{
                                                item.typeName
                                            }}
                                            </a-option>
                                        </a-select>
                                    </a-form-item>
                                </a-col> -->
          <!-- <a-col :span="6">
                                    <a-form-item label="纱批" field="yarnBatch" label-col-flex="100px">
                                        <a-input class="bacClass" v-model="dataForm.yarnBatch" />
                                    </a-form-item>
                                </a-col> -->
          <!-- <a-col :span="6">
                                    <a-form-item label="总条数" field="totleNum" label-col-flex="100px"
                                        :rules="[{ type: 'number', required: true, max: 9999999999, min: 0, message: '输入不合法' }]"
                                        :validate-trigger="['change',]">
                                        <a-input-number class="bacClass"  v-model="dataForm.totleNum" placeholder="请输入总条数" />
                                    </a-form-item>
                                </a-col> -->
          <!-- <a-col :span="6">
                                    <a-form-item label="计算方式" field="computeMode" label-col-flex="100px">
                                        <a-select popup-container="html"  class="bacClass" allow-clear v-model="dataForm.computeMode">
                                            <a-option :value="0">条距</a-option>
                                            <a-option :value="1">路数</a-option>
                                        </a-select>
                                    </a-form-item>
                                </a-col> -->
          <!-- </a-row> -->
          <a-row :gutter="16">
            <!-- <a-col :span="6">
                                    <a-form-item label="纱长" field="yarnLong" label-col-flex="100px">
                                        <a-input class="bacClass" v-model="dataForm.yarnLong" />
                                    </a-form-item>
                                </a-col> -->
            <!-- <a-col :span="6">
                                    <a-form-item label="客户品名" field="customProductName" label-col-flex="100px">
                                        <a-input class="bacClass" v-model="dataForm.customProductName" />
                                    </a-form-item>
                                </a-col> -->
            <a-col :span="6">
              <a-form-item label="是否抽针" field="drawnNeedleState" label-col-flex="100px">
                <!-- <a-select popup-container="html"  class="bacClass" @click="hqZt" v-model="dataForm.workDrum" allow-clear
                                            allow-search>
                                            <a-option v-for="item in ztDataList">{{ item.cylinderCardNumber }}
                                            </a-option>
                                        </a-select> -->
                <a-select
                  popup-container="html"
                  class="bacClass"
                  allow-clear
                  v-model="dataForm.drawnNeedleState"
                >
                  <a-option :value="1">圆筒</a-option>
                  <a-option :value="0">抽针</a-option>
                  <a-option :value="2"></a-option>
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item label="是否开幅" field="widthState" label-col-flex="100px">
                <!-- <a-select popup-container="html"  class="bacClass" allow-create allow-search @click="lxSelect"
                                            v-model="dataForm.type">
                                            <a-option v-for="kflx in lxList" :value="kflx.typeName">{{
                                                kflx.typeName
                                            }}</a-option>
                                        </a-select> -->
                <a-select popup-container="html" class="bacClass" v-model="dataForm.widthState">
                  <a-option :value="0">不开幅</a-option>
                  <a-option :value="1">开幅</a-option>
                  <a-option :value="2"></a-option>
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item label="成品门幅" label-col-flex="100px">
                <a-input disabled v-model="dataForm.width" class="bacClass" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item label="成品克重" field="weight" label-col-flex="100px">
                <a-input disabled v-model="dataForm.weight" class="bacClass" />
              </a-form-item>
            </a-col>
          </a-row>
          <!-- <a-row :gutter="16"> -->
          <!-- <a-col :span="6">
                                    <a-form-item label="水洗门幅" label-col-flex="100px">
                                        <a-input class="bacClass" v-model="dataForm.washWidth" />
                                    </a-form-item>
                                </a-col> -->
          <!-- </a-row> -->
          <a-row :gutter="16">
            <!-- <a-col :span="6">
                                    <a-form-item label="水洗克重" field="washWeight" label-col-flex="100px"
                                        :rules="[{ type: 'number', required: true, max: 9999999999, min: 0, message: '输入不合法' }]"
                                        :validate-trigger="['change',]">
                                        <a-input class="bacClass" v-model="dataForm.washWeight" />
                                    </a-form-item>
                                </a-col> -->
            <!-- <a-col :span="6">
                                    <a-form-item label="计划颜色" field="planColorName" label-col-flex="100px">
                                        <a-select popup-container="html"  class="bacClass" @click="hqColor" v-model="dataForm.planColorName"
                                            allow-clear allow-search>
                                            <a-option v-for="item in ysDataList">{{ item.colorName }}</a-option>
                                        </a-select>
                                    </a-form-item>
                                </a-col> -->
            <a-col :span="6">
              <a-form-item label="可配色称" field="colorName" label-col-flex="100px">
                <!-- <a-select popup-container="html" class="bacClass" @click="hqColor('')" @search="hqColor($event)"
                  v-model="dataForm.colorName" allow-clear allow-search>
                  <a-option v-for="item in ysDataList">{{ item.colorName }}</a-option>
                </a-select> -->
                <a-input class="bacClass" v-model="dataForm.colorName"></a-input>
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item label="可配色称说明" field="colorDescription" label-col-flex="100px">
                <a-input class="bacClass" v-model="dataForm.colorDescription"></a-input>
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item label="要求开机台数" field="planMachineNum" label-col-flex="100px">
                <a-input class="bacClass" v-model="dataForm.planMachineNum" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                label="织造交期"
                field="weavDeliveryDate"
                label-col-flex="100px"
                :rules="[{ required: true, message: '必填' }]"
                :validate-trigger="['change', 'blur']"
              >
                <a-date-picker
                  popup-container="html"
                  :disabled-date="disabledDate"
                  placeholder=" "
                  class="bacClass"
                  v-model="dataForm.weavDeliveryDate"
                />
              </a-form-item>
            </a-col>
          </a-row>
          <!-- <a-row :gutter="16"> -->
          <!-- <a-col :span="6">
                                    <a-form-item label="原料交期" field="rawmaterialDeliveryDate" label-col-flex="100px">
                                        <a-date-picker  popup-container="html"  placeholder=" " class="bacClass"
                                            v-model="dataForm.rawmaterialDeliveryDate" />
                                    </a-form-item>
                                </a-col> -->
          <!-- <a-col :span="6">
                                <a-form-item label="品牌">
                                    <a-input class="bacClass" placeholder="请输入品牌" v-model="dataForm.brandName" />
                                </a-form-item>
                            </a-col> -->
          <!-- </a-row> -->
          <!-- <a-row :gutter="16">
                            <a-col :span="6">
                                <a-form-item label="出货日期" field="shipmentDate">
                                    <a-date-picker  popup-container="html"  v-model="dataForm.shipmentDate" />
                                </a-form-item>
                            </a-col>
                        </a-row> -->
          <!-- </a-collapse-item> -->
          <!-- <a-collapse-item header="其他信息" :key="3"> -->
          <a-row :gutter="16">
            <a-col :span="6">
              <!-- <a-form-item label="加工单位" field="outSouringCompany" label-col-flex="100px"> -->
              <!-- <a-select popup-container="html"  class="bacClass" v-model="dataForm.outSouringCompanyId" @change="outSouringCompanys"
                                allow-clear>
                                <a-option v-for="item in gsDatas" :value="item.id">{{ item.typeName }}{{
                                    item.typeName == "" ? "" : "-"
                                }}{{ item.firmName }}</a-option>
                            </a-select> -->
              <CorporateSectorCascader
                ref="cascaderRefRef"
                :configCascader="configCascader"
                @changeCascader="changeCascader"
              />
              <!-- </a-form-item> -->
            </a-col>
            <a-col :span="6">
              <!-- <a-form-item label="验布单位" field="verifyClothCompany" label-col-flex="100px"> -->
              <!-- <a-select popup-container="html"  class="bacClass" v-model="dataForm.verifyClothCompany" allow-clear>
                                <a-option v-for="item in gsDatas">{{ item.typeName }}{{
                                    item.typeName == "" ?
                                    "" : "-"
                                }}{{ item.firmName }}</a-option>
                            </a-select> -->
              <CorporateSectorCascader
                ref="cascaderRef2"
                :configCascader="configCascader2"
                @changeCascader="changeCascader2"
              />
              <!-- </a-form-item> -->
            </a-col>
            <!-- <a-col :span="6">
                                    <a-form-item label="收货单位编号" field="receiptCompanyCode" label-col-flex="100px">
                                        <a-input class="bacClass" v-model="dataForm.receiptCompanyCode" />
                                    </a-form-item>
                                </a-col> -->
            <a-col :span="6">
              <a-form-item label="收货单位" field="receiptCompany" label-col-flex="100px">
                <!-- <a-select popup-container="html"  class="bacClass" v-model="dataForm.receiptCompany" allow-clear>
                                            <a-option v-for="item in gsDatas">{{ item.typeName }}{{
                                                item.typeName == "" ?
                                                    "" : "-"
                                            }}{{ item.firmName }}</a-option>
                                        </a-select> -->
                <a-select
                  popup-container="html"
                  class="bacClass"
                  allow-clear
                  allow-search
                  v-model="dataForm.receiptCompany"
                  @click="shFun"
                >
                  <a-option v-for="item in shArrays">{{ item.detailName }}</a-option>
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item label="缩水率控制" field="shrinkageControl" label-col-flex="100px">
                <a-input class="bacClass" v-model="dataForm.shrinkageControl" />
              </a-form-item>
            </a-col>
          </a-row>
          <!-- <a-row :gutter="16"> -->
          <!-- <a-col :span="6">
                                    <a-form-item label="下单部门" field="orderDepartment" label-col-flex="100px">
                                        <a-select popup-container="html"  class="bacClass" v-model="dataForm.orderDepartment" allow-clear>
                                            <a-option v-for="item in gsDatas"> {{ item.typeName }}{{
                                                item.typeName == "" ?
                                                "" : "-"
                                            }}{{ item.firmName }}</a-option>
                                        </a-select>
                                    </a-form-item>
                                </a-col> -->
          <!-- <a-col :span="6">
                                    <a-form-item label="损耗率" field="lossRate" label-col-flex="100px">
                                        <a-input class="bacClass" v-model="dataForm.lossRate" />
                                    </a-form-item>
                                </a-col> -->
          <!-- <a-col :span="6">
                                    <a-form-item label="生产方式" field="productMode" label-col-flex="100px">
                                        <a-input disabled v-model="dataForm.productMode" />
                                    </a-form-item>
                                </a-col> -->
          <!-- </a-row> -->
          <a-row :gutter="16">
            <a-col :span="6">
              <a-form-item label="胶管" field="rubberTube" label-col-flex="100px">
                <a-select
                  popup-container="html"
                  class="bacClass"
                  allow-search
                  allow-clear
                  @click="jgCx('')"
                  @search="jgCx($event)"
                  v-model="dataForm.rubberTube"
                >
                  <a-option v-for="item in jgCxArray">{{ item.detailName }}</a-option>
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                label="包装要求"
                field="packRequire"
                label-col-flex="100px"
                :rules="[{ required: true, message: '必填' }]"
                :validate-trigger="['change', 'blur']"
              >
                <!-- <a-input class="bacClass" placeholder="请输入包装要求" v-model="dataForm.packRequire" /> -->
                <a-select
                  popup-container="html"
                  class="bacClass"
                  allow-clear
                  @click="isBz"
                  v-model="dataForm.packRequire"
                >
                  <a-option v-for="item in bzYq">{{ item.detailName }}</a-option>
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item label="主推商品" field="productColthCode" label-col-flex="100px">
                <a-input class="bacClass" v-model="dataForm.productColthCode" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item label="审核人" field="auditPerson" label-col-flex="100px">
                <a-input class="bacClass" disabled v-model="dataForm.auditPerson" />
              </a-form-item>
            </a-col>
            <!-- <a-col :span="6">
                                    <a-form-item label="试纱单号" field="tryYarnCode" label-col-flex="100px">
                                        <a-input class="bacClass" v-model="dataForm.tryYarnCode" />
                                    </a-form-item>
                                </a-col> -->
          </a-row>
          <!-- <a-row :gutter="16"> -->
          <!-- <a-col :span="6">
                                    <a-form-item label="试纱类型" field="tryYarnType" label-col-flex="100px">
                                        <a-input class="bacClass" v-model="dataForm.tryYarnType" />
                                    </a-form-item>
                                </a-col> -->
          <!-- <a-col :span="6">
                                    <a-form-item label="织针型号" field="weavNeedleModelNo" label-col-flex="100px">
                                        <a-input class="bacClass" v-model="dataForm.weavNeedleModelNo" />
                                    </a-form-item>
                                </a-col> -->
          <!-- </a-row> -->
          <!-- <a-row :gutter="16"> -->
          <!-- <a-col :span="19">
                                    <a-form-item label="备注" label-col-flex="100px">
                                        <a-input class="bacClass" v-model="dataForm.remark" />
                                    </a-form-item>
                                </a-col> -->
          <!-- </a-row> -->
          <a-row :gutter="16">
            <a-col :span="18">
              <a-form-item label="送货单备注" field="deliveryRemark" label-col-flex="100px">
                <!-- <a-input class="bacClass" v-model="dataForm.deliveryRemark" /> -->
                <a-select
                  popup-container="html"
                  class="bacClass"
                  allow-clear
                  allow-search
                  v-model="dataForm.deliveryRemark"
                  @click="dingdanFun"
                >
                  <a-option v-for="item in dingdanArrays">{{ item.detailName }}</a-option>
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item label="理论落布转数" label-col-flex="100px">
                <a-input-number
                  v-model="dataForm.rotate"
                  class="bacClass"
                  :min="0"
                  :precision="0"
                  disabled
                />
              </a-form-item>
            </a-col>
          </a-row>
          <a-row :gutter="16">
            <a-col :span="18">
              <a-form-item label="织布单备注" field="orderCaption" label-col-flex="100px">
                <a-input class="bacClass" v-model="dataForm.orderCaption" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item label="是否织损" label-col-flex="100px">
                <a-switch
                  checked-color="#35d46a"
                  unchecked-color="#e8e8e9"
                  v-model="dataForm.weaveLossState"
                  :checked-value="1"
                  :unchecked-value="0"
                >
                  <template #checked> 是</template>
                  <template #unchecked> 否</template>
                </a-switch>
              </a-form-item>
            </a-col>
          </a-row>
          <a-row :gutter="16">
            <a-col :span="18">
              <a-form-item label="修改备注" field="remark" label-col-flex="100px">
                <a-input class="bacClass" v-model="dataForm.remark" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item label="是否待试纱结果" label-col-flex="120px">
                <!-- <a-input class="bacClass" placeholder="请输入订单性质" v-model="dataForm.orderNature" /> -->
                <!-- <a-select popup-container="html"  class="bacClass" allow-clear allow-search
                                            v-model="dataForm.orderNature" @click="dingdanFun">
                                            <a-option v-for="item in dingdanArrays">{{item.detailName}}</a-option>
                                        </a-select> -->
                <a-checkbox v-model="checked2"></a-checkbox>
              </a-form-item>
            </a-col>
          </a-row>
          <a-row :gutter="16">
            <a-col :span="18">
              <a-form-item label-col-flex="100px" label="织造备注" :disabled="pageData.isDetails">
                <a-textarea
                  disabled
                  :class="{ bacClass: true }"
                  placeholder=""
                  v-model="dataForm.weavRemark"
                  :max-length="400"
                  allow-clear
                  show-word-limit
                />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                label="是否试纱"
                label-col-flex="120px"
                :disabled="dataForm.processType == 1"
              >
                <a-checkbox v-model="dataForm.IsTria"></a-checkbox>
              </a-form-item>
            </a-col>
          </a-row>
          <!-- </a-collapse-item> -->
          <!-- </a-collapse> -->
        </a-form>

        <a-tabs :lazy-load="true" style="margin-bottom: 20px">
          <a-tab-pane title="原料信息" key="1">
            <AgGridVuesCopys
              :rowHeight="33"
              :headerHeight="33"
              :suppressCopyRowsToClipboard="true"
              rowSelection="multiple"
              @grid-ready="gridReady3"
              style="height: 250px"
              :defaultColDef="defaultColDef"
              class="ag-theme-alpine"
              :rowData="tableDateList"
              :columnDefs="tableColumns1No1"
              :localeText="localeText"
            >
            </AgGridVuesCopys>
          </a-tab-pane>
          <a-tab-pane title="排针" key="2">
            <div style="width: 100%; overflow: auto">
              <div style="white-space: nowrap">
                <span
                  style="padding: 5px"
                  v-if="jiTypes != '单面机'"
                  :style="{
                    'margin-right':
                      zzpzdata[0].alignState == '3' && zzpzdata.length > 0 ? '7.5px' : '',
                  }"
                  >上排</span
                >
                <span style="padding: 5px" v-else>排针</span>
                <input
                  @keyup="setNum(item)"
                  v-for="(item, index) in zzpzdata"
                  :key="index"
                  style="width: 30px; border: 1px solid black; padding: 5px; text-align: center"
                  :class="{ bacClass: true }"
                  v-model="item.upBasin"
                  disabled
                />
              </div>
              <div style="white-space: nowrap" v-if="jiTypes != '单面机'">
                <span
                  style="padding: 5px"
                  :style="{
                    'padding-right': jiTypes == '螺纹机' ? '35px' : '5px',
                    'margin-right':
                      zzpzdata[0].alignState == '1' && zzpzdata.length > 0
                        ? '15px'
                        : zzpzdata[0].alignState == '2' && zzpzdata.length > 0
                        ? '7.5px'
                        : '',
                  }"
                  >下排</span
                >

                <input
                  @keyup="setNum1(item)"
                  v-for="(item, index) in zzpzdata"
                  :key="index"
                  :class="{ bacClass: true }"
                  style="width: 30px; border: 1px solid black; padding: 5px; text-align: center"
                  v-model="item.belowBasin"
                  disabled
                />
              </div>
            </div>

            <div style="display: flex; align-items: center">
              <div style="width: 50%">
                <span>裁口排针</span>
                <a-textarea :class="{ bacClass: true }" v-model="ckpzobj.pinHeader" disabled>
                </a-textarea>
              </div>
              <div style="width: 50%">
                <span>纱线排列</span>
                <a-textarea :class="{ bacClass: true }" v-model="ckpzobj.arrangement" disabled>
                </a-textarea>
              </div>
            </div>
          </a-tab-pane>
          <a-tab-pane title="排三角" key="3">
            <div
              v-for="(item, index) in sjdata.sj as any"
              style="text-align: center; margin: 20px auto; width: 100%; overflow-x: auto"
            >
              <div
                style="
                  text-align: center;
                  color: #165dff;
                  font-size: 16px;
                  background-color: aliceblue;
                  border-bottom: 0.5px solid #ccc;
                "
              >
                {{ item.type }}
              </div>

              <div class="thead" style="background-color: aliceblue">
                <div class="th" style="width: 50px">序号</div>
                <div class="th" style="width: 150px">用针</div>
                <div
                  class="th"
                  style="width: 40px"
                  v-for="i2 in item.typeData[0].needleList"
                  :key="i2.way"
                >
                  {{ i2.way }}
                </div>
              </div>
              <div class="tbody" v-for="i1 in item.typeData">
                <div class="td" style="width: 50px">{{ i1.serialNumber }}</div>
                <div class="td" style="width: 150px">
                  <a-input disabled v-model="i1.needleName"></a-input>
                </div>
                <div
                  class="td"
                  style="height: 34px; width: 40px; vertical-align: middle; border: 1px solid gray"
                  v-for="i2 in i1.needleList"
                >
                  <div style="width: 100%; height: 100%"
                    >{{ tags.filter((o) => o.id === i2.needle)[0]?.val }}
                  </div>
                </div>
              </div>
              <div style="height: 20px"></div>
              <div style="height: 20px"></div>
              <div style="border: 1px solid #ccc"></div>
            </div>
            <div class="tbody" style="margin-top: 10px">
              <div
                style="
                  text-align: center;
                  color: #165dff;
                  font-size: 16px;
                  background-color: aliceblue;
                  border-bottom: 0.5px solid #ccc;
                "
              >
                排纱
              </div>
              <div class="trow" style="background-color: aliceblue">
                <div
                  style="
                    height: 30px;
                    display: inline-block;
                    width: 82px;
                    vertical-align: top;
                    box-sizing: border-box;
                  "
                >
                </div>
                <div
                  style="
                    height: 30px;
                    display: inline-block;
                    width: 82px;
                    vertical-align: top;
                    box-sizing: border-box;
                  "
                >
                </div>
              </div>
              <div class="trow" v-for="(item, index) in psList">
                <div
                  style="border: 1px solid #ccc; height: 30px; box-sizing: border-box"
                  v-for="(item1, index1) in item"
                >
                  <input
                    v-model="item1.val"
                    v-if="
                      !((index > 0 && (index1 == 0 || index1 == 1)) || (index == 0 && index1 === 2))
                    "
                    style="width: 80px; vertical-align: top; height: 100%; text-align: center"
                    :class="{ active: index1 == 0 || index1 == 1 }"
                  />
                  <div
                    v-if="
                      (index > 0 && (index1 == 0 || index1 == 1)) || (index == 0 && index1 === 2)
                    "
                    style="width: 80px; vertical-align: top; height: 100%; text-align: center"
                    :class="{ active: index1 == 0 || index1 == 1 }"
                    >{{ item1.val }}
                  </div>
                </div>
              </div>
            </div>
          </a-tab-pane>
          <a-tab-pane title="变更记录" key="4" v-if="pageData.sideTitle == '修改织布单'">
            <!-- <a-table size="mini" :scrollbar="true" sticky-header stripe :bordered="true" :columns="tableColumns2"
              @page-change="pagination1.change" :loading="tables1.tableLoading" :data="tables2.dataList" :pagination="{
                size: 'small',
                current: pagination1.page,
                pageSize: pagination1.pageSize,
                total: pagination1.total,
              }" rowKey="id">
            </a-table> -->
            <AgGridVuesCopys
              :rowHeight="33"
              :headerHeight="33"
              :suppressCopyRowsToClipboard="true"
              rowSelection="multiple"
              @grid-ready="gridReady2_1"
              style="height: 250px"
              :defaultColDef="defaultColDef"
              class="ag-theme-alpine"
              :rowData="tableDateList2_1"
              :columnDefs="tableColumns2"
              :localeText="localeText1"
            >
            </AgGridVuesCopys>
          </a-tab-pane>
          <!-- <a-tab-pane title="注意事项" key="5">
                        <a-textarea class="bacClass" v-model="dataForm.otherRemark" allow-clear />
                    </a-tab-pane> -->
        </a-tabs>
      </div>
      <!-- </a-spin> -->

      <!-- </div> -->
    </a-drawer>
    <a-drawer
      height="100%"
      :style="{ zIndex: 999 }"
      :mask-closable="false"
      popup-container=".table-page-body"
      placement="bottom"
      :visible="pageData.showAdd1"
      unmountOnClose
      :closable="false"
    >
      <template #title>
        {{ pageData.sideTitle }}
      </template>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="sideNo1">取消</el-button>
          <el-button type="primary" @click="guanbis" v-if="pageData.sideTitle == '修改织布单'"
            >保存</el-button
          >
        </span>
      </template>
      <!-- <a-spin :loading="loadings" tip="加载中" style="width: 100%;"> -->
      <div style="min-width: 1300px; overflow: auto">
        <div>
          <a-form ref="formRef" :model="dataForm" size="mini">
            <!-- <a-collapse :default-active-key="[1]"> -->
            <!-- <a-collapse-item header="业务信息" :key="1"> -->
            <a-row :gutter="16">
              <!-- <a-col :span="6">
                                    <a-form-item label="计划单号" field="planOrderCode" label-col-flex="100px">
                                        <a-input disabled v-model="dataForm.planOrderCode" />
                                    </a-form-item>
                                </a-col> -->
              <a-col :span="6">
                <a-form-item label="织布单号" field="weavClothCode" label-col-flex="100px">
                  <a-input disabled v-model="dataForm.weavClothCode" class="bacClass" />
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="是否本集团" label-col-flex="100px">
                  <a-select
                    popup-container="html"
                    allow-clear
                    disabled
                    v-model="dataForm.processType"
                    class="bacClass"
                    @change="changeProcessType"
                  >
                    <a-option :value="0">本集团</a-option>
                    <a-option :value="1">外加工</a-option>
                  </a-select>
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="客户订单号" field="customOrderNo" label-col-flex="100px">
                  <a-input disabled v-model="dataForm.customOrderNo" class="bacClass" />
                </a-form-item>
              </a-col>
              <!-- <a-col :span="6">
                                <a-form-item label="织布编号" field="weavClothCode">
                                    <a-input placeholder="请输入织布单号" v-model="dataForm.weavClothCode" />
                                </a-form-item>
                            </a-col> -->
              <a-col :span="6">
                <a-form-item label="客户名称" field="customName" label-col-flex="100px">
                  <!-- <a-select popup-container="html"  class="bacClass" allow-clear allow-search @click="khmcSelect"
                                            v-model="dataForm.customName">
                                            <a-option v-for="kh in khmclist" :value="kh['brandName']">
                                                {{ kh['brandName'] }}
                                            </a-option>
                                        </a-select> -->
                  <a-input v-model="dataForm.customName" disabled class="bacClass"></a-input>
                </a-form-item>
              </a-col>
            </a-row>
            <a-row :gutter="16">
              <a-col :span="6">
                <a-form-item label="是否急单" field="orderNature" label-col-flex="100px">
                  <!-- <a-input disabled v-model="dataForm.orderNature" /> -->
                  <a-checkbox v-model="checked" disabled></a-checkbox>
                </a-form-item>
              </a-col>
              <!-- <a-col :span="6">
                                    <a-form-item label="业务部门" field="businessDepartment" label-col-flex="100px">
                                        <a-cascader disabled v-model="dataForm.businessDepartmentId" :options="firmLists"
                                            allow-clear />
                                    </a-form-item>
                                </a-col>
                                <a-col :span="6">
                                    <a-form-item label="业务员" field="businessPerson" label-col-flex="100px">
                                        <a-input disabled v-model="dataForm.businessPerson" />
                                    </a-form-item>
                                </a-col> -->
              <a-col :span="6">
                <a-form-item label="织单类型" field="businessType" label-col-flex="100px">
                  <a-input disabled v-model="dataForm.businessType" class="bacClass" />
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="制版费" field="makeEditionCost" label-col-flex="100px">
                  <a-input disabled v-model="dataForm.makeEditionCost" class="bacClass" />
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item
                  label="指令重量"
                  field="orderWeight"
                  label-col-flex="100px"
                  :rules="[
                    {
                      type: 'number',
                      required: true,
                      max: 9999999999,
                      min: 0,
                      message: '输入不合法',
                    },
                  ]"
                  :validate-trigger="['change']"
                >
                  <a-input-number
                    @change="orderWeights"
                    disabled
                    v-model="dataForm.orderWeight"
                    class="bacClass"
                    @blur="blurOrderWeight"
                  >
                    <template #append>
                      <span style="width: 30px"> KG</span>
                    </template>
                  </a-input-number>
                </a-form-item>
              </a-col>
            </a-row>
            <a-row :gutter="16">
              <a-col :span="6">
                <a-form-item
                  label="公斤/匹"
                  field="pieceWeight"
                  label-col-flex="100px"
                  :rules="[
                    {
                      type: 'number',
                      required: true,
                      max: 9999999999,
                      min: 0,
                      message: '输入不合法',
                    },
                  ]"
                  :validate-trigger="['change']"
                >
                  <a-input-number
                    @change="isTy"
                    disabled
                    v-model="dataForm.pieceWeight"
                    class="bacClass"
                  >
                  </a-input-number>
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="匹数" label-col-flex="100px">
                  <a-input-number disabled v-model="dataForm.pieceNum" class="bacClass">
                  </a-input-number>
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="加工单价" field="price" label-col-flex="100px">
                  <a-input-number
                    v-model="dataForm.price"
                    :disabled="pageData.sideTitle != '修改织布单'"
                    :min="0"
                    @change="isDj"
                    :precision="2"
                    class="bacClass"
                  />
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="金额" field="amount" label-col-flex="100px">
                  <a-input-number
                    disabled
                    v-model="dataForm.amount"
                    class="bacClass"
                    :precision="2"
                  >
                  </a-input-number>
                </a-form-item>
              </a-col>
            </a-row>
            <a-row :gutter="16">
              <a-col :span="6">
                <a-form-item label="开单日期" field="planDate" label-col-flex="100px">
                  <a-input disabled v-model="dataForm.planDate" class="bacClass" />
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="开单人" field="tabulationPerson" label-col-flex="100px">
                  <a-input disabled v-model="dataForm.tabulationPerson" class="bacClass" />
                </a-form-item>
              </a-col>
              <!-- <a-col :span="6">
                                <a-form-item label="化料时间" field="chemicalTime">
                                    <a-input placeholder="请输入化料时间" v-model="dataForm.chemicalTime" />
                                </a-form-item>
                            </a-col> -->
              <a-col :span="6">
                <a-form-item label="坯布编号" field="greyCode" label-col-flex="100px">
                  <!-- <a-select popup-container="html"  class="bacClass" @change="changes1" placeholder="请输入坯布编号" v-model="dataForm.greyCode"
                                        allow-clear allow-search>
                                        <a-option v-for="item in isDatasList">{{ item.greyCode }}</a-option>
                                    </a-select> -->
                  <a-input disabled v-model="dataForm.greyCode" class="bacClass"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="客户坯布编号" field="outsideGreigeCode" label-col-flex="100px">
                  <a-input disabled v-model="dataForm.outsideGreigeCode" class="bacClass"></a-input>
                </a-form-item>
              </a-col>
            </a-row>
            <!-- </a-collapse-item> -->
            <!-- <a-collapse-item header="计划单信息" :key="2"> -->
            <a-row :gutter="16">
              <!-- <a-col :span="6">
                                    <a-form-item label="织造序号" field="weaveCode" label-col-flex="100px">
                                        <a-input disabled v-model="dataForm.weaveCode" />
                                    </a-form-item>
                                </a-col> -->
              <a-col :span="12">
                <a-form-item
                  label="坯布名称"
                  field="greyName"
                  label-col-flex="100px"
                  :rules="[{ required: true, message: '输入坯布名称' }]"
                  :validate-trigger="['change']"
                >
                  <a-select
                    popup-container="html"
                    disabled
                    :style="{ width: '640px' }"
                    :loading="loading"
                    class="bacClass"
                    allow-clear
                    allow-search
                    @search="handleSearch"
                    v-model="dataForm.greyName"
                    :filter-option="false"
                    @focus="focusSel"
                  >
                    <a-option v-for="item in pageData.clothList" :value="item.grayFabricName"
                      >{{ item.grayFabricName }}
                    </a-option>
                  </a-select>
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="坯布批号" field="greyBatchNo" label-col-flex="100px">
                  <!-- <a-input-group @change="changePb" v-model="dataForm.greyBatchNo"> -->
                  <!-- <a-input class="bacClass" @change="changes2" v-model="pibuArray.pibu1" disabled />
                                        <span>-</span>
                                        <a-input class="bacClass" @change="changes3" v-model="pibuArray.pibu2" disabled /> -->
                  <a-input v-model="dataForm.greyBatchNo" disabled class="bacClass" />
                  <!-- </a-input-group> -->
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="针寸数" field="workDrum" label-col-flex="100px">
                  <!-- <a-select popup-container="html"  disabled @click="hqZt" v-model="dataForm.workDrum" allow-clear
                                            allow-search>
                                            <a-option v-for="item in ztDataList">{{ item.cylinderCardNumber }}
                                            </a-option>
                                        </a-select> -->
                  <a-input disabled v-model="dataForm.workDrum" class="bacClass"></a-input>
                </a-form-item>
              </a-col>
            </a-row>
            <a-row :gutter="16">
              <a-col :span="6">
                <a-form-item label="是否抽针" label-col-flex="100px">
                  <a-select
                    popup-container="html"
                    disabled
                    allow-clear
                    v-model="dataForm.drawnNeedleState"
                    class="bacClass"
                  >
                    <a-option :value="0">抽针</a-option>
                    <a-option :value="1">圆筒</a-option>
                    <a-option :value="2"></a-option>
                  </a-select>
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="是否开幅" field="widthState" label-col-flex="100px">
                  <!-- <a-input placeholder="请输入是否开幅" v-model="dataForm.widthState" /> -->
                  <a-select
                    popup-container="html"
                    disabled
                    v-model="dataForm.widthState"
                    class="bacClass"
                  >
                    <a-option :value="1">开幅</a-option>
                    <a-option :value="0">不开幅</a-option>
                  </a-select>
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="成品门幅" label-col-flex="100px">
                  <a-input disabled v-model="dataForm.width" class="bacClass" />
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="成品克重" field="weight" label-col-flex="100px">
                  <a-input disabled v-model="dataForm.weight" class="bacClass" />
                </a-form-item>
              </a-col>
            </a-row>
            <!-- <a-row :gutter="16"> -->
            <!-- <a-col :span="6">
                                    <a-form-item label="水洗门幅" label-col-flex="100px">
                                        <a-input disabled v-model="dataForm.washWidth" />
                                    </a-form-item>
                                </a-col> -->
            <!-- </a-row> -->
            <a-row :gutter="16">
              <!-- <a-col :span="6">
                                    <a-form-item label="水洗克重" field="washWeight" label-col-flex="100px"
                                        :rules="[{ type: 'number', required: true, max: 9999999999, min: 0, message: '输入不合法' }]"
                                        :validate-trigger="['change',]">
                                        <a-input disabled v-model="dataForm.washWeight" />
                                    </a-form-item>
                                </a-col> -->
              <!-- <a-col :span="6">
                                    <a-form-item label="计划颜色" field="planColorName" label-col-flex="100px">
                                        <a-select popup-container="html"  @click="hqColor" v-model="dataForm.planColorName" allow-clear allow-search
                                            disabled>
                                            <a-option v-for="item in ysDataList">{{ item.colorName }}</a-option>
                                        </a-select>
                                    </a-form-item>
                                </a-col> -->
              <a-col :span="6">
                <a-form-item label="可配色称" field="colorName" label-col-flex="100px">
                  <!-- <a-select popup-container="html" @click="hqColor('')" @search="hqColor($event)"
                    v-model="dataForm.colorName" allow-clear allow-search class="bacClass" disabled>
                    <a-option v-for="item in ysDataList">{{ item.colorName }}</a-option>
                  </a-select> -->
                  <a-input class="bacClass" v-model="dataForm.colorName" disabled></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="可配色称说明" field="colorDescription" label-col-flex="100px">
                  <a-input disabled v-model="dataForm.colorDescription" class="bacClass"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="要求开机台数" field="planMachineNum" label-col-flex="100px">
                  <a-input disabled v-model="dataForm.planMachineNum" class="bacClass" />
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="织造交期" field="weavDeliveryDate" label-col-flex="100px">
                  <a-date-picker
                    popup-container="html"
                    disabled
                    v-model="dataForm.weavDeliveryDate"
                    class="bacClass"
                  />
                </a-form-item>
              </a-col>
            </a-row>
            <!-- <a-row :gutter="16"> -->
            <!-- <a-col :span="6">
                                    <a-form-item label="原料交期" field="rawmaterialDeliveryDate" label-col-flex="100px">
                                        <a-date-picker  popup-container="html"  disabled v-model="dataForm.rawmaterialDeliveryDate" />
                                    </a-form-item>
                                </a-col> -->
            <!-- <a-col :span="6">
                                <a-form-item label="品牌">
                                    <a-input placeholder="请输入品牌" v-model="dataForm.brandName" />
                                </a-form-item>
                            </a-col> -->
            <!-- </a-row> -->
            <!-- <a-row :gutter="16">
                            <a-col :span="6">
                                <a-form-item label="出货日期" field="shipmentDate">
                                    <a-date-picker  popup-container="html"  v-model="dataForm.shipmentDate" />
                                </a-form-item>
                            </a-col>
                        </a-row> -->
            <!-- </a-collapse-item> -->
            <!-- <a-collapse-item header="其他信息" :key="3"> -->
            <a-row :gutter="16">
              <a-col :span="6">
                <a-form-item label="加工单位" field="outSouringCompany" label-col-flex="100px">
                  <!-- <a-select popup-container="html"  disabled v-model="dataForm.outSouringCompany">
                                    <a-option v-for="item in gsDatas">{{ item.typeName }}{{
                                        item.typeName == "" ?
                                        "" : "-"
                                    }}{{ item.firmName }}</a-option>
                                </a-select> -->
                  <a-input disabled v-model="dataForm.outSouringCompany" class="bacClass"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="验布单位" field="verifyClothCompany" label-col-flex="100px">
                  <!-- <a-select popup-container="html"  disabled v-model="dataForm.verifyClothCompany">
                                    <a-option v-for="item in gsDatas">{{ item.typeName }}{{
                                        item.typeName == "" ?
                                        "" : "-"
                                    }}{{ item.firmName }}</a-option>
                                </a-select> -->
                  <a-input
                    disabled
                    v-model="dataForm.verifyClothCompany"
                    class="bacClass"
                  ></a-input>
                </a-form-item>
              </a-col>
              <!-- <a-col :span="6">
                                    <a-form-item label="收货单位编号" field="receiptCompanyCode" label-col-flex="100px">
                                        <a-input disabled v-model="dataForm.receiptCompanyCode" />
                                    </a-form-item>
                                </a-col> -->
              <a-col :span="6">
                <a-form-item label="收货单位" field="receiptCompany" label-col-flex="100px">
                  <!-- <a-select popup-container="html"  disabled v-model="dataForm.receiptCompany">
                                    <a-option v-for="item in gsDatas">{{ item.typeName }}{{
                                        item.typeName == "" ?
                                        "" : "-"
                                    }}{{ item.firmName }}</a-option>
                                </a-select> -->
                  <a-input disabled v-model="dataForm.receiptCompany" class="bacClass"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="缩水率控制" field="shrinkageControl" label-col-flex="100px">
                  <a-input disabled v-model="dataForm.shrinkageControl" class="bacClass" />
                </a-form-item>
              </a-col>
            </a-row>
            <!-- <a-row :gutter="16"> -->
            <!-- <a-col :span="6">
                                    <a-form-item label="下单部门" field="orderDepartment" label-col-flex="100px">
                                        <a-select popup-container="html"  disabled v-model="dataForm.orderDepartment">
                                            <a-option v-for="item in gsDatas">{{ item.typeName }}{{
                                                item.typeName == "" ?
                                                "" : "-"
                                            }}{{ item.firmName }}</a-option>
                                        </a-select>
                                    </a-form-item>
                                </a-col> -->
            <!-- <a-col :span="6">
                                    <a-form-item label="损耗率" field="lossRate" label-col-flex="100px">
                                        <a-input disabled v-model="dataForm.lossRate" />
                                    </a-form-item>
                                </a-col>
                                <a-col :span="6">
                                    <a-form-item label="生产方式" field="productMode" label-col-flex="100px">
                                        <a-input disabled v-model="dataForm.productMode" />
                                    </a-form-item>
                                </a-col> -->
            <!-- </a-row> -->
            <a-row :gutter="16">
              <a-col :span="6">
                <a-form-item label="胶管" field="rubberTube" label-col-flex="100px">
                  <a-select
                    popup-container="html"
                    disabled
                    allow-search
                    allow-clear
                    @click="jgCx('')"
                    @search="jgCx($event)"
                    v-model="dataForm.rubberTube"
                    class="bacClass"
                  >
                    <a-option v-for="item in jgCxArray">{{ item.rubberhoseName }}</a-option>
                  </a-select>
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="包装要求" field="packRequire" label-col-flex="100px">
                  <!-- <a-input placeholder="请输入包装要求" v-model="dataForm.packRequire" /> -->
                  <a-select
                    popup-container="html"
                    disabled
                    allow-clear
                    @click="isBz"
                    v-model="dataForm.packRequire"
                    class="bacClass"
                  >
                    <a-option v-for="item in bzYq">{{ item.detailName }}</a-option>
                  </a-select>
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="主推商品" field="productColthCode" label-col-flex="100px">
                  <a-input disabled v-model="dataForm.productColthCode" class="bacClass" />
                </a-form-item>
              </a-col>
              <!-- <a-col :span="6">
                                    <a-form-item label="试纱单号" field="tryYarnCode" label-col-flex="100px">
                                        <a-input disabled v-model="dataForm.tryYarnCode" />
                                    </a-form-item>
                                </a-col> -->
              <a-col :span="6">
                <a-form-item label="审核人" field="auditPerson" label-col-flex="100px">
                  <a-input disabled v-model="dataForm.auditPerson" class="bacClass" />
                </a-form-item>
              </a-col>
            </a-row>
            <!-- <a-row :gutter="16"> -->
            <!-- <a-col :span="6">
                                    <a-form-item label="试纱类型" field="tryYarnType" label-col-flex="100px">
                                        <a-input disabled v-model="dataForm.tryYarnType" />
                                    </a-form-item>
                                </a-col>
                                <a-col :span="6">
                                    <a-form-item label="织针型号" field="weavNeedleModelNo" label-col-flex="100px">
                                        <a-input disabled v-model="dataForm.weavNeedleModelNo" />
                                    </a-form-item>
                                </a-col> -->
            <!-- </a-row> -->
            <a-row :gutter="16">
              <!-- <a-col :span="19">
                                    <a-form-item label="备注" label-col-flex="100px">
                                        <a-input disabled v-model="dataForm.remark" />
                                    </a-form-item>
                                </a-col> -->
            </a-row>
            <a-row :gutter="16">
              <a-col :span="18">
                <a-form-item label="织布单备注" field="orderCaption" label-col-flex="100px">
                  <a-input disabled v-model="dataForm.orderCaption" class="bacClass" />
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="理论落布转数" label-col-flex="100px">
                  <a-input-number
                    v-model="dataForm.rotate"
                    class="bacClass"
                    :min="0"
                    :precision="0"
                    disabled
                  />
                </a-form-item>
              </a-col>
            </a-row>
            <a-row :gutter="16">
              <a-col :span="18">
                <a-form-item label="修改备注" field="remark" label-col-flex="100px">
                  <a-input class="bacClass" v-model="dataForm.remark" />
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="是否织损" label-col-flex="100px">
                  <!-- drawnNeedle -->
                  <a-switch
                    checked-color="#35d46a"
                    unchecked-color="#e8e8e9"
                    v-model="dataForm.weaveLossState"
                    disabled
                    :checked-value="1"
                    :unchecked-value="0"
                  >
                    <template #checked> 是</template>
                    <template #unchecked> 否</template>
                  </a-switch>
                </a-form-item>
              </a-col>
            </a-row>
            <a-row :gutter="16">
              <a-col :span="18">
                <a-form-item label="送货单备注" field="deliveryRemark" label-col-flex="100px">
                  <a-input disabled v-model="dataForm.deliveryRemark" class="bacClass" />
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="是否待试纱结果" label-col-flex="120px">
                  <a-checkbox v-model="checked2" disabled></a-checkbox>
                </a-form-item>
              </a-col>
            </a-row>
            <a-row :gutter="16">
              <a-col :span="18">
                <a-form-item
                  :style="{ width: '950px' }"
                  label-col-flex="100px"
                  label="织造备注"
                  :disabled="pageData.isDetails"
                >
                  <a-textarea
                    disabled
                    :class="{ bacClass: true }"
                    placeholder=""
                    v-model="dataForm.weavRemark"
                    :max-length="400"
                    allow-clear
                    show-word-limit
                  />
                </a-form-item>
              </a-col>
              <a-col :span="6">
                <a-form-item label="是否试纱" label-col-flex="120px">
                  <a-checkbox v-model="dataForm.IsTria" disabled></a-checkbox>
                </a-form-item>
              </a-col>
            </a-row>
            <!-- </a-collapse-item> -->
            <!-- </a-collapse> -->
          </a-form>
        </div>
        <a-tabs :lazy-load="true">
          <a-tab-pane title="原料信息" key="1">
            <!-- <a-table size="mini" :scrollbar="true" sticky-header stripe :bordered="true" :columns="tableColumns1"
              v-model:selected-keys="selectedRowKeys1" :loading="tables.tableLoading" :data="tableDateList" rowKey="id">
            </a-table> -->
            <AgGridVuesCopys
              :rowHeight="33"
              :headerHeight="33"
              :suppressCopyRowsToClipboard="true"
              rowSelection="multiple"
              @grid-ready="gridReady3"
              style="height: 250px"
              @columnResized="onColumnResized4"
              @columnMoved="onColumnMoved4"
              :defaultColDef="defaultColDef"
              class="ag-theme-alpine"
              :rowData="tableDateList"
              :columnDefs="tableColumns1No2"
              :localeText="localeText"
            ></AgGridVuesCopys>
          </a-tab-pane>
          <a-tab-pane title="排针" key="2">
            <div style="width: 100%; overflow: auto">
              <div style="white-space: nowrap">
                <span
                  style="padding: 5px"
                  v-if="jiTypes != '单面机'"
                  :style="{
                    'margin-right':
                      zzpzdata.length > 0 && zzpzdata[0].alignState == '3' ? '7.5px' : '',
                  }"
                  >上排</span
                >
                <span style="padding: 5px" v-else>排针</span>
                <input
                  @keyup="setNum(item)"
                  v-for="(item, index) in zzpzdata"
                  :key="index"
                  style="width: 30px; border: 1px solid black; padding: 5px; text-align: center"
                  :class="{ bacClass: true }"
                  v-model="item.upBasin"
                  disabled
                />
              </div>
              <div style="white-space: nowrap" v-if="jiTypes != '单面机'">
                <span
                  style="padding: 5px"
                  :style="{
                    'padding-right': jiTypes == '螺纹机' ? '35px' : '5px',
                    'margin-right':
                      zzpzdata.length > 0 && zzpzdata[0].alignState == '1'
                        ? '15px'
                        : zzpzdata.length > 0 && zzpzdata[0].alignState == '2'
                        ? '7.5px'
                        : '',
                  }"
                  >下排</span
                >

                <input
                  @keyup="setNum1(item)"
                  v-for="(item, index) in zzpzdata"
                  :key="index"
                  :class="{ bacClass: true }"
                  style="width: 30px; border: 1px solid black; padding: 5px; text-align: center"
                  v-model="item.belowBasin"
                  disabled
                />
              </div>
            </div>

            <div style="display: flex; align-items: center">
              <div style="width: 50%">
                <span>裁口排针</span>
                <a-textarea :class="{ bacClass: true }" v-model="ckpzobj.pinHeader" disabled>
                </a-textarea>
              </div>
              <div style="width: 50%">
                <span>纱线排列</span>
                <a-textarea :class="{ bacClass: true }" v-model="ckpzobj.arrangement" disabled>
                </a-textarea>
              </div>
            </div>
          </a-tab-pane>
          <a-tab-pane title="排三角" key="3">
            <div
              v-for="(item, index) in sjdata.sj as any"
              style="text-align: center; margin: 20px auto; width: 100%; overflow-x: auto"
            >
              <div
                style="
                  text-align: center;
                  color: #165dff;
                  font-size: 16px;
                  background-color: aliceblue;
                  border-bottom: 0.5px solid #ccc;
                "
              >
                {{ item.type }}
              </div>

              <div class="thead" style="background-color: aliceblue">
                <div class="th" style="width: 50px">序号</div>
                <div class="th" style="width: 150px">用针</div>
                <div
                  class="th"
                  style="width: 40px"
                  v-for="i2 in item.typeData[0].needleList"
                  :key="i2.way"
                >
                  {{ i2.way }}
                </div>
              </div>
              <div class="tbody" v-for="i1 in item.typeData">
                <div class="td" style="width: 50px">{{ i1.serialNumber }}</div>
                <div class="td" style="width: 150px">
                  <a-input disabled v-model="i1.needleName"></a-input>
                </div>
                <div
                  class="td"
                  style="height: 34px; width: 40px; vertical-align: middle; border: 1px solid gray"
                  v-for="i2 in i1.needleList"
                >
                  <div style="width: 100%; height: 100%"
                    >{{ tags.filter((o) => o.id === i2.needle)[0]?.val }}
                  </div>
                </div>
              </div>
              <div style="height: 20px"></div>
              <div style="height: 20px"></div>
              <div style="border: 1px solid #ccc"></div>
            </div>
            <div class="tbody" style="margin-top: 10px">
              <div
                style="
                  text-align: center;
                  color: #165dff;
                  font-size: 16px;
                  background-color: aliceblue;
                  border-bottom: 0.5px solid #ccc;
                "
              >
                排纱
              </div>
              <div class="trow" style="background-color: aliceblue">
                <div
                  style="
                    height: 30px;
                    display: inline-block;
                    width: 82px;
                    vertical-align: top;
                    box-sizing: border-box;
                  "
                >
                </div>
                <div
                  style="
                    height: 30px;
                    display: inline-block;
                    width: 82px;
                    vertical-align: top;
                    box-sizing: border-box;
                  "
                >
                </div>
              </div>
              <div class="trow" v-for="(item, index) in psList">
                <div
                  style="border: 1px solid #ccc; height: 30px; box-sizing: border-box"
                  v-for="(item1, index1) in item"
                >
                  <input
                    v-model="item1.val"
                    v-if="
                      !((index > 0 && (index1 == 0 || index1 == 1)) || (index == 0 && index1 === 2))
                    "
                    style="width: 80px; vertical-align: top; height: 100%; text-align: center"
                    :class="{ active: index1 == 0 || index1 == 1 }"
                  />
                  <div
                    v-if="
                      (index > 0 && (index1 == 0 || index1 == 1)) || (index == 0 && index1 === 2)
                    "
                    style="width: 80px; vertical-align: top; height: 100%; text-align: center"
                    :class="{ active: index1 == 0 || index1 == 1 }"
                    >{{ item1.val }}
                  </div>
                </div>
              </div>
            </div>
          </a-tab-pane>
          <a-tab-pane
            title="变更记录"
            key="4"
            v-if="pageData.sideTitle == '修改织布单' || pageData.sideTitle == '织布单详情'"
          >
            <!-- <a-table size="mini" :scrollbar="true" sticky-header stripe :bordered="true" :columns="tableColumns2"
              @page-change="pagination1.change" :loading="tables1.tableLoading" :data="tables2.dataList" :pagination="{
                size: 'small',
                current: pagination1.page,
                pageSize: pagination1.pageSize,
                total: pagination1.total,
              }" rowKey="id">
            </a-table> -->
            <AgGridVuesCopys
              :rowHeight="33"
              :headerHeight="33"
              :suppressCopyRowsToClipboard="true"
              rowSelection="multiple"
              @grid-ready="gridReady2_1"
              style="height: 250px"
              :defaultColDef="defaultColDef"
              class="ag-theme-alpine"
              :rowData="tableDateList2_1"
              :columnDefs="tableColumns2"
              :localeText="localeText1"
            >
            </AgGridVuesCopys>
          </a-tab-pane>
          <!-- <a-tab-pane title="注意事项" key="5">
                    <a-textarea disabled v-model="dataForm.otherRemark" allow-clear />
                </a-tab-pane> -->
        </a-tabs>
      </div>
      <!-- </a-spin> -->
    </a-drawer>
  </pageTabelLayout>
  <a-modal v-model:visible="visible" :width="1200" :on-before-ok="handleOk" @cancel="handleCancel">
    <template #title> 选择库存</template>
    <div class="isyouUtyrer">
      <span>
        选择仓库:
        <a-select
          popup-container="html"
          class="bacClass"
          :style="{ width: '200px' }"
          @change="ckmctSelects"
          v-model="whCuselect"
          allow-clear
          allow-search
        >
          <a-option v-for="kht in ckmctList" :value="kht.id">{{ kht.warehouseName }}</a-option>
        </a-select></span
      >
      <span
        >纱批:
        <a-input :style="{ width: '200px' }" v-model="productionBatch" class="bacClass"></a-input>
      </span>
      <a-button size="mini" type="primary" shape="round" @click="selectWhCz">查询</a-button>
    </div>
    <AgGridVuesCopys
      :rowHeight="33"
      :headerHeight="33"
      :suppressCopyRowsToClipboard="true"
      rowSelection="multiple"
      @grid-ready="gridReady2"
      style="height: 500px"
      :defaultColDef="defaultColDef"
      class="ag-theme-alpine"
      :rowData="tableDataList2"
      :columnDefs="tc2"
      :localeText="localeText1"
    ></AgGridVuesCopys>
    <paginationCopys
      :total="pagination2.total"
      show-total
      show-jumper
      show-page-size
      @change="PageSize2"
      @page-size-change="change2"
      style="justify-content: center"
      :page-size="pagination2.pageSize"
      :current="pagination2.page"
    />
  </a-modal>
  <!-- <el-dialog v-model="ChangeButtonVisible" :width="800" title="变更">
    <a-form size="small" :model="ChangeButtonForm">
      <a-row :gutter="20">
        <a-col :span="20">
          <h3>织布单信息：</h3>
        </a-col>
      </a-row>
      <a-row :gutter="20">
        <a-col :span="10">
          <a-form-item label="织布单号：" label-col-flex="130px">
            <span>{{ ChangeButtonForm.planOrderCode }}</span>
          </a-form-item>
        </a-col>
        <a-col :span="10">
          <a-form-item label="客户名称：" label-col-flex="130px">
            <span>{{ ChangeButtonForm.customName }}</span>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row :gutter="20">
        <a-col :span="10">
          <a-form-item label="订单状态：" label-col-flex="130px">
            <span>{{
                ChangeButtonForm.schedulState == 0
                    ? '待排产'
                    : ChangeButtonForm.schedulState == 1
                        ? '已排产'
                        : ChangeButtonForm.schedulState == 2
                            ? '生产中'
                            : ChangeButtonForm.schedulState == 3
                                ? '订单完结'
                                : ''
              }}</span>
          </a-form-item>
        </a-col>
        <a-col :span="10">
          <a-form-item label="织造交期：" label-col-flex="130px">
            <span>{{ dayjs(ChangeButtonForm.weavDeliveryDate).format('YYYY-MM-DD') }}</span>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row :gutter="20">
        <a-col :span="10">
          <a-form-item label="指令重量：" label-col-flex="130px">
            <span>{{ ChangeButtonForm.orderWeight }}</span>
          </a-form-item>
        </a-col>
        <a-col :span="10">
          <a-form-item label="匹数：" label-col-flex="130px">
            <span>{{ ChangeButtonForm.pieceNum }}</span>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row :gutter="20">
        <a-col :span="10">
          <a-form-item label="已生产：" label-col-flex="130px">
            <span>{{ ChangeButtonForm.productionWeight }}</span>
          </a-form-item>
        </a-col>
        <a-col :span="10">
          <a-form-item label="欠织：" label-col-flex="130px">
            <span>{{ ChangeButtonForm.oweWeight }}</span>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row :gutter="20">
        <a-col :span="20">
          <h3>变更信息：</h3>
        </a-col>
      </a-row>
      <a-row :gutter="20">
        <a-col :span="10">
          <a-form-item label="变更重量：" label-col-flex="130px">
            <el-input placeholder="" type="number" v-model="ChangeButtonForm.changeWeight" @change="changeInput"/>
          </a-form-item>
        </a-col>
        <a-col :span="10">
          <a-form-item label="变更交期：" label-col-flex="130px">
            <el-date-picker v-model="ChangeButtonForm.changeWeavDeliveryDate" type="date"/>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row :gutter="20">
        <a-col :span="10">
          <a-form-item label="变更后指令重量：" label-col-flex="130px">
            <span>{{ ChangeButtonForm.changeOrderWeight }}</span>
          </a-form-item>
        </a-col>
        <a-col :span="10">
          <a-form-item label="变更后匹数：" label-col-flex="130px">
            <span>{{ ChangeButtonForm.changePieceNum }}</span>
          </a-form-item>
        </a-col>
      </a-row>
    </a-form>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="ChangeButtonVisible = false">取消</el-button>
        <el-button type="primary" @click="handleBeforeOk"> 保存 </el-button>
      </span>
    </template>
  </el-dialog> -->
  <!-- 变更弹窗 -->
  <a-drawer
    style="z-index: 999"
    ok-text=""
    cancel-text=""
    :style="{ zIndex: 999 }"
    height="100%"
    :mask-closable="false"
    popup-container=".table-page-body"
    placement="bottom"
    :visible="ChangeButtonVisible"
    unmountOnClose
    :closable="true"
  >
    <template #title>
      {{ pageData.sideTitle }}
    </template>
    <div v-loading="addLoding" style="min-width: 1300px; overflow: auto">
      <a-form ref="formRef" :model="dataForm1" size="mini" :disabled="handleReturnShow">
        <a-row :gutter="16">
          <a-col :span="6">
            <a-form-item label="织布单状态" label-col-flex="100px">
              <!-- <a-input class="bacClass" disabled v-model="dataForm.schedulState" /> -->
              <span style="margin-left: 10px; color: red">{{
                dataForm1.schedulState == 0
                  ? '待排产'
                  : dataForm1.schedulState == 1
                  ? '已排产'
                  : dataForm1.schedulState == 2
                  ? '生产中'
                  : dataForm1.schedulState == 3
                  ? '完成'
                  : '暂停'
              }}</span>
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="已生产匹数" label-col-flex="100px">
              <a-input class="bacClass" disabled v-model="dataForm1.makeNum" />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="未生产匹数" label-col-flex="100px">
              <a-input class="bacClass" disabled v-model="dataForm1.noMakeNum" />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="是否织损" label-col-flex="100px">
              <a-switch
                disabled
                checked-color="#35d46a"
                unchecked-color="#e8e8e9"
                v-model="dataForm1.weaveLossState"
                :checked-value="1"
                :unchecked-value="0"
              >
                <template #checked> 是</template>
                <template #unchecked> 否</template>
              </a-switch>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16">
          <a-col :span="6">
            <a-form-item label="已织重量" label-col-flex="100px">
              <a-input class="bacClass" disabled v-model="dataForm1.makeWeight" />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="未织重量" label-col-flex="100px">
              <a-input class="bacClass" disabled v-model="dataForm1.noMakeWeight" />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="变更前指令重量" label-col-flex="110px">
              <a-input class="bacClass" disabled v-model="dataForm1.orderWeight" />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item
              label="变更重量"
              field="changeWeight"
              :rules="[
                {
                  type: 'number',
                  required: true,
                  message: '输入不合法',
                },
              ]"
              :validate-trigger="['change']"
              label-col-flex="100px"
            >
              <a-input-number
                class="bacClass"
                style="background: white !important"
                @change="orderWeights1"
                v-model="dataForm1.changeWeight"
                @blur="blurOrderWeights1"
                :step="1"
                :precision="0"
              >
                <template #append>
                  <span style="width: 30px"> KG</span>
                </template>
              </a-input-number>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16">
          <a-col :span="6">
            <a-form-item label="织布单号" field="weavClothCode" label-col-flex="100px">
              <a-input class="bacClass" disabled v-model="dataForm1.weavClothCode" />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item
              label="是否本集团"
              label-col-flex="100px"
              :rules="[{ required: true, message: '是否本集团必填' }]"
              :validate-trigger="['change', 'blur']"
            >
              <a-select
                popup-container="html"
                allow-clear
                class="bacClass"
                v-model="dataForm1.processType"
                disabled
              >
                <a-option :value="0">本集团</a-option>
                <a-option :value="1">外加工</a-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="客户订单号" field="customOrderNo" label-col-flex="100px">
              <a-input class="bacClass" disabled v-model="dataForm1.customOrderNo" />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item
              label="客户名称"
              field="customName"
              label-col-flex="100px"
              :rules="[{ required: true, message: '客户名称必填' }]"
              :validate-trigger="['change', 'blur']"
            >
              <a-select
                disabled
                popup-container="html"
                class="bacClass"
                allow-clear
                allow-search
                @click="khmcSelect('')"
                @search="khmcSelect($event)"
                v-model="dataForm1.customName"
              >
                <a-option v-for="kh in khmclist" :value="kh['brandName']">
                  {{ kh['brandName'] }}
                </a-option>
              </a-select>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16">
          <a-col :span="6">
            <a-form-item label="是否急单" label-col-flex="100px">
              <a-checkbox v-model="checked" disabled></a-checkbox>
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item
              label="织单类型"
              field="businessType"
              label-col-flex="100px"
              :rules="[{ required: true, message: '织单类型必填' }]"
              :validate-trigger="['change', 'blur']"
            >
              <a-select
                disabled
                popup-container="html"
                class="bacClass"
                allow-clear
                allow-search
                v-model="dataForm1.businessType"
                @click="ywFun('')"
                @search="ywFun($event)"
              >
                <a-option v-for="item in ywArrays">{{ item.weaveOrderType }}</a-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item
              label="制版费"
              field="makeEditionCost"
              label-col-flex="100px"
              :rules="[{ required: true, message: '必填' }]"
              :validate-trigger="['change', 'blur']"
            >
              <a-input-number
                disabled
                class="bacClass"
                v-model="dataForm1.makeEditionCost"
                :precision="2"
                :min="0"
              />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="变更后指令重量" field="orderChangeWeight" label-col-flex="110px">
              <a-input-number disabled class="bacClass" v-model="dataForm1.orderChangeWeight">
                <template #append>
                  <span style="width: 30px"> KG</span>
                </template>
              </a-input-number>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16">
          <a-col :span="6">
            <a-form-item
              label="公斤/匹"
              field="pieceWeight"
              :rules="[
                {
                  type: 'number',
                  required: true,
                  max: 9999999999,
                  min: 0,
                  message: '输入不合法',
                },
              ]"
              :validate-trigger="['change']"
              label-col-flex="100px"
            >
              <a-input-number
                class="bacClass"
                @change="isTy"
                v-model="dataForm1.pieceWeight"
                :step="1"
                :precision="0"
              >
              </a-input-number>
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item
              label="匹数"
              :rules="[
                {
                  type: 'number',
                  required: true,
                  max: 9999999999,
                  min: 0,
                  message: '输入不合法',
                },
              ]"
              :validate-trigger="['change']"
              label-col-flex="100px"
            >
              <a-input-number
                disabled
                class="bacClass"
                v-model="dataForm1.pieceNum"
                @change="isPs"
                :step="1"
                :precision="0"
              >
              </a-input-number>
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="加工单价" field="price" label-col-flex="100px">
              <a-input-number
                v-model="dataForm1.price"
                @change="isDj1"
                :step="0.01"
                :min="0"
                :precision="0"
                class="bacClass"
              />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="金额" field="amount" label-col-flex="100px">
              <a-input-number disabled v-model="dataForm1.amount" class="bacClass" :precision="2">
              </a-input-number>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16">
          <a-col :span="6">
            <a-form-item label="开单日期" field="planDate" label-col-flex="100px">
              <a-input disabled v-model="dataForm1.planDate" class="bacClass" />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="开单人" field="tabulationPerson" label-col-flex="100px">
              <a-input disabled v-model="dataForm1.tabulationPerson" class="bacClass" />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item
              label="坯布编号"
              field="greyCode"
              label-col-flex="100px"
              :rules="[{ required: true, message: '必填' }]"
              :validate-trigger="['change', 'blur']"
            >
              <a-select
                disabled
                popup-container="html"
                class="bacClass"
                @click="changes1('')"
                @search="changes1($event)"
                @change="changes11"
                v-model="dataForm1.greyCode"
                allow-clear
                allow-search
              >
                <a-option v-for="item in isDatasListMap" :value="item.greyCode"
                  >{{ item.greyCode + ' —— ' + item.grayFabricName }}
                </a-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="客户坯布编号" field="outsideGreigeCode" label-col-flex="100px">
              <a-input disabled v-model="dataForm1.outsideGreigeCode" class="bacClass"></a-input>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16">
          <a-col :span="12">
            <a-form-item
              label="坯布名称"
              field="greyName"
              label-col-flex="100px"
              :rules="[{ required: true, message: '输入坯布名称' }]"
              :validate-trigger="['change']"
            >
              <a-select
                popup-container="html"
                class="bacClass"
                disabled
                :style="{ width: '640px' }"
                :loading="loading"
                allow-clear
                allow-search
                @search="handleSearch"
                v-model="dataForm1.greyName"
                :filter-option="false"
                @focus="focusSel"
              >
                <a-option v-for="item in pageData.clothList" :value="item.grayFabricName"
                  >{{ item.grayFabricName }}
                </a-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="坯布批号" field="greyBatchNo" label-col-flex="100px">
              <a-input disabled class="bacClass" v-model="dataForm1.greyBatchNo" />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="针寸数" label-col-flex="100px">
              <a-input disabled v-model="dataForm1.workDrum" class="bacClass"></a-input>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16">
          <a-col :span="6">
            <a-form-item label="是否抽针" field="drawnNeedleState" label-col-flex="100px">
              <a-select
                disabled
                popup-container="html"
                class="bacClass"
                allow-clear
                v-model="dataForm1.drawnNeedleState"
              >
                <a-option :value="1">圆筒</a-option>
                <a-option :value="0">抽针</a-option>
                <a-option :value="2"></a-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="是否开幅" field="widthState" label-col-flex="100px">
              <a-select
                disabled
                popup-container="html"
                class="bacClass"
                v-model="dataForm1.widthState"
              >
                <a-option :value="0">不开幅</a-option>
                <a-option :value="1">开幅</a-option>
                <a-option :value="2"></a-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="成品门幅" label-col-flex="100px">
              <a-input disabled v-model="dataForm1.width" class="bacClass" />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="成品克重" field="weight" label-col-flex="100px">
              <a-input disabled v-model="dataForm1.weight" class="bacClass" />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16">
          <a-col :span="6">
            <a-form-item label="可配色称" field="colorName" label-col-flex="100px">
              <!-- <a-select popup-container="html" class="bacClass" @click="hqColor('')" @search="hqColor($event)"
                v-model="dataForm1.colorName" allow-clear allow-search>
                <a-option v-for="item in ysDataList">{{ item.colorName }}</a-option>
              </a-select> -->
              <a-input class="bacClass" v-model="dataForm.colorName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="可配色称说明" field="colorDescription" label-col-flex="100px">
              <a-input disabled class="bacClass" v-model="dataForm1.colorDescription"></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="要求开机台数" field="planMachineNum" label-col-flex="100px">
              <a-input disabled class="bacClass" v-model="dataForm1.planMachineNum" />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item
              label="织造交期"
              field="weavDeliveryDate"
              label-col-flex="100px"
              :rules="[{ required: true, message: '必填' }]"
              :validate-trigger="['change', 'blur']"
            >
              <a-date-picker
                popup-container="html"
                class="bacClass"
                v-model="dataForm1.weavDeliveryDate"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16">
          <a-col :span="6">
            <a-form-item label="加工单位" field="outSouringCompany" label-col-flex="100px">
              <a-input disabled v-model="dataForm1.outSouringCompany" class="bacClass"></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="验布单位" field="verifyClothCompany" label-col-flex="100px">
              <a-input disabled v-model="dataForm1.verifyClothCompany" class="bacClass"></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="收货单位" field="receiptCompany" label-col-flex="100px">
              <a-input disabled v-model="dataForm1.receiptCompany" class="bacClass"></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="缩水率控制" field="shrinkageControl" label-col-flex="100px">
              <a-input disabled class="bacClass" v-model="dataForm1.shrinkageControl" />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16">
          <a-col :span="6">
            <a-form-item label="胶管" field="rubberTube" label-col-flex="100px">
              <a-select
                popup-container="html"
                class="bacClass"
                allow-search
                allow-clear
                @click="jgCx('')"
                @search="jgCx($event)"
                v-model="dataForm1.rubberTube"
              >
                <a-option v-for="item in jgCxArray">{{ item.detailName }}</a-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item
              label="包装要求"
              field="packRequire"
              label-col-flex="100px"
              :rules="[{ required: true, message: '必填' }]"
              :validate-trigger="['change', 'blur']"
            >
              <a-select
                popup-container="html"
                class="bacClass"
                allow-clear
                @click="isBz"
                v-model="dataForm1.packRequire"
              >
                <a-option v-for="item in bzYq">{{ item.detailName }}</a-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="主推商品" field="productColthCode" label-col-flex="100px">
              <a-input disabled class="bacClass" v-model="dataForm1.productColthCode" />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="审核人" field="auditPerson" label-col-flex="100px">
              <a-input class="bacClass" disabled v-model="dataForm1.auditPerson" />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16">
          <a-col :span="18">
            <a-form-item label="送货单备注" field="deliveryRemark" label-col-flex="100px">
              <a-select
                popup-container="html"
                class="bacClass"
                allow-clear
                allow-search
                v-model="dataForm1.deliveryRemark"
                @click="dingdanFun"
              >
                <a-option v-for="item in dingdanArrays">{{ item.detailName }}</a-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="理论落布转数" field="rotate" label-col-flex="100px">
              <a-input-number v-model="dataForm1.rotate" class="bacClass" disabled />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16">
          <a-col :span="19">
            <a-form-item label="织布单备注" field="orderCaption" label-col-flex="100px">
              <a-input class="bacClass" v-model="dataForm1.orderCaption" />
            </a-form-item>
          </a-col>
        </a-row>

        <a-row :gutter="16">
          <a-col :span="24">
            <a-form-item :style="{ width: '1372px' }" label-col-flex="100px" label="织造备注">
              <a-textarea
                disabled
                :class="{ bacClass: true }"
                placeholder=""
                v-model="dataForm1.weavRemark"
                :max-length="400"
                allow-clear
                show-word-limit
              />
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>

      <a-tabs :lazy-load="true">
        <a-tab-pane title="原料信息" key="1">
          <AgGridVuesCopys
            :rowHeight="33"
            :headerHeight="33"
            :suppressCopyRowsToClipboard="true"
            rowSelection="multiple"
            @grid-ready="gridReady3"
            style="height: 250px"
            @columnResized="onColumnResized4"
            @columnMoved="onColumnMoved4"
            :defaultColDef="defaultColDef"
            class="ag-theme-alpine"
            :rowData="tableDateList_1"
            :columnDefs="tableColumns1No2"
            :localeText="localeText"
          ></AgGridVuesCopys>
        </a-tab-pane>
        <a-tab-pane title="排针" key="2">
          <div style="width: 100%; overflow: auto">
            <div style="white-space: nowrap">
              <span style="padding: 5px" v-if="jiTypes != '单面机'">上排</span>
              <span style="padding: 5px" v-else>排针</span>
              <input
                @keyup="setNum(item)"
                v-for="(item, index) in zzpzdata"
                :key="index"
                style="width: 30px; border: 1px solid black; padding: 5px; text-align: center"
                :class="{ bacClass: true }"
                v-model="item.upBasin"
                disabled
              />
            </div>
            <div style="white-space: nowrap" v-if="jiTypes != '单面机'">
              <span
                style="padding: 5px"
                :style="{
                  'padding-right': jiTypes == '螺纹机' ? '35px' : '5px',
                }"
                >下排</span
              >

              <input
                @keyup="setNum1(item)"
                v-for="(item, index) in zzpzdata"
                :key="index"
                :class="{ bacClass: true }"
                style="width: 30px; border: 1px solid black; padding: 5px; text-align: center"
                v-model="item.belowBasin"
                disabled
              />
            </div>
          </div>

          <div style="display: flex; align-items: center">
            <div style="width: 50%">
              <span>裁口排针</span>
              <a-textarea :class="{ bacClass: true }" v-model="ckpzobj.pinHeader" disabled>
              </a-textarea>
            </div>
            <div style="width: 50%">
              <span>纱线排列</span>
              <a-textarea :class="{ bacClass: true }" v-model="ckpzobj.arrangement" disabled>
              </a-textarea>
            </div>
          </div>
        </a-tab-pane>
        <a-tab-pane title="排三角" key="3">
          <div
            v-for="(item, index) in sjdata.sj as any"
            style="text-align: center; margin: 20px auto; width: 100%; overflow-x: auto"
          >
            <div
              style="
                text-align: center;
                color: #165dff;
                font-size: 16px;
                background-color: aliceblue;
                border-bottom: 0.5px solid #ccc;
              "
            >
              {{ item.type }}
            </div>

            <div class="thead" style="background-color: aliceblue">
              <div class="th" style="width: 50px">序号</div>
              <div class="th" style="width: 150px">用针</div>
              <div
                class="th"
                style="width: 40px"
                v-for="i2 in item.typeData[0].needleList"
                :key="i2.way"
              >
                {{ i2.way }}
              </div>
            </div>
            <div class="tbody" v-for="i1 in item.typeData">
              <div class="td" style="width: 50px">{{ i1.serialNumber }}</div>
              <div class="td" style="width: 150px">
                <a-input disabled v-model="i1.needleName"></a-input>
              </div>
              <div
                class="td"
                style="height: 34px; width: 40px; vertical-align: middle; border: 1px solid gray"
                v-for="i2 in i1.needleList"
              >
                <div style="width: 100%; height: 100%"
                  >{{ tags.filter((o) => o.id === i2.needle)[0]?.val }}
                </div>
              </div>
            </div>
            <div style="height: 20px"></div>
            <div style="height: 20px"></div>
            <div style="border: 1px solid #ccc"></div>
          </div>
          <div class="tbody" style="margin-top: 10px">
            <div
              style="
                text-align: center;
                color: #165dff;
                font-size: 16px;
                background-color: aliceblue;
                border-bottom: 0.5px solid #ccc;
              "
            >
              排纱
            </div>
            <div class="trow" style="background-color: aliceblue">
              <div
                style="
                  height: 30px;
                  display: inline-block;
                  width: 82px;
                  vertical-align: top;
                  box-sizing: border-box;
                "
              >
              </div>
              <div
                style="
                  height: 30px;
                  display: inline-block;
                  width: 82px;
                  vertical-align: top;
                  box-sizing: border-box;
                "
              >
              </div>
            </div>
            <div class="trow" v-for="(item, index) in psList">
              <div
                style="border: 1px solid #ccc; height: 30px; box-sizing: border-box"
                v-for="(item1, index1) in item"
              >
                <input
                  v-model="item1.val"
                  v-if="
                    !((index > 0 && (index1 == 0 || index1 == 1)) || (index == 0 && index1 === 2))
                  "
                  style="width: 80px; vertical-align: top; height: 100%; text-align: center"
                  :class="{ active: index1 == 0 || index1 == 1 }"
                />
                <div
                  v-if="(index > 0 && (index1 == 0 || index1 == 1)) || (index == 0 && index1 === 2)"
                  style="width: 80px; vertical-align: top; height: 100%; text-align: center"
                  :class="{ active: index1 == 0 || index1 == 1 }"
                  >{{ item1.val }}
                </div>
              </div>
            </div>
          </div>
        </a-tab-pane>
      </a-tabs>
    </div>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="ChangeButtonVisible1">取消</el-button>
        <el-button v-if="!handleReturnShow" @click="sideNos" :loading="pageData.drawerLoading"
          >保存并提交</el-button
        >
        <el-button v-if="!handleReturnShow" type="primary" @click="sideOks" :loading="sideAddLoading">
          保存
        </el-button>
      </span>
    </template>
  </a-drawer>
  <el-dialog
    v-model="addWeightDialog"
    :width="800"
    title="选择规则"
    v-loading="pageData.addWeightLoading"
    top="35vh"
  >
    <el-row :gutter="20">
      <el-radio-group v-model="addWeightRadio" @change="addWeightChange">
        <!-- <el-radio label="1" border>加大重量平均分配给机台</el-radio> -->
        <el-radio label="2" border>增加机器完成加大重量</el-radio>
      </el-radio-group>
      <el-col :span="4" v-show="addWeightRadio == '2'">
        <el-button @click="Machine" type="primary" style="margin-left: 10px">选择机台号</el-button>
      </el-col>
      <el-col :span="4" v-show="addWeightRadio == '2'">
        <el-button @click="deleteInventory" type="warning">删除</el-button>
      </el-col>
    </el-row>

    <!-- <div v-show="addWeightRadio == '2' && machineList.length != 0">
      <div class="jth" v-for="(item, index) in machineList" :key="index">
        <span>{{ item.coordinate }}</span
        >,
      </div>
    </div> -->
    <div v-show="addWeightRadio == '2'" style="width: 100%; height: 300px; margin-top: 20px">
      <encapsulation-agrid ref="refgridOption2" :configaggrid="configaggrid2"></encapsulation-agrid>
    </div>

    <template #footer>
      <span class="dialog-footer">
        <el-button @click="addWeightDialog = false">取消</el-button>
        <el-button type="primary" @click="addWeightOk"> 确定 </el-button>
      </span>
    </template>
  </el-dialog>
  <!-- 织布单机台弹窗 -->
  <el-dialog
    style="z-index: 1000"
    v-model="dblclicksShowA2"
    :width="1080"
    :height="800"
    title=""
    draggable
  >
    <div style="margin-bottom: 10px">
      <el-button type="primary" @click="saveAdd"> 增加机台 </el-button>
    </div>
    <AgGridVuesCopys
      :rowHeight="33"
      :headerHeight="33"
      :suppressCopyRowsToClipboard="true"
      :suppressDragLeaveHidesColumns="true"
      @grid-ready="gridReadyA2"
      style="height: 60vh; width: 100%"
      :defaultColDef="defaultColDef"
      class="ag-theme-alpine"
      :rowData="tcA2DataList"
      :columnDefs="tcA2"
      :localeText="localeText1"
    ></AgGridVuesCopys>
    <template #footer>
      <span class="dialog-footer">
        <el-button type="primary" @click="() => (dblclicksShowA2 = false)">关闭</el-button>

        <el-button v-if="dataShow" type="primary" @click="saveZjt1" :loading="dialogLoading">
          确认
        </el-button>
        <el-button v-else type="primary" @click="saveZjt" :loading="dialogLoading">
          确认
        </el-button>
      </span>
    </template>
  </el-dialog>
  <!-- 新增机台弹窗 -->
  <el-dialog
    style="z-index: 1001"
    v-model="dblclicksShowA3"
    :width="1000"
    :height="600"
    title=""
    draggable
  >
    <template #title>
      <div>
        <center style="font-size: 20px"> 机台详情</center>
      </div>
      <div style="float: left; margin-left: 15px">
        <a-form-item label="机台号" label-col-flex="70px">
          <a-input class="bacClass" v-model="machineCodeXZ" :style="{ width: '200px' }" />
        </a-form-item>
      </div>
      <div style="float: right">
        <el-button type="primary" @click="selectCx"> 查询</el-button>
      </div>
    </template>
    <AgGridVuesCopys
      :rowHeight="33"
      :headerHeight="33"
      :suppressCopyRowsToClipboard="true"
      :suppressDragLeaveHidesColumns="true"
      @grid-ready="gridReadyA3"
      style="height: 60vh; width: 100%"
      :defaultColDef="defaultColDef"
      class="ag-theme-alpine"
      :rowData="tcA3DataList"
      :columnDefs="tcA3"
      :localeText="localeText1"
    ></AgGridVuesCopys>
    <template #footer>
      <span class="dialog-footer">
        <el-button type="primary" @click="() => (dblclicksShowA3 = false)">关闭</el-button>
        <el-button type="primary" @click="saveZjtA3" :loading="dialogLoading"> 确认 </el-button>
      </span>
    </template>
  </el-dialog>
  <!-- 提示弹窗 -->
  <el-dialog v-model="dblclicksShowA4" :width="600" title="温馨提示">
    <center>
      <!-- {{ dblclicksText }} -->
      <ul style="list-style-type: none">
        <li
          v-for="(item, index) in dblclicksText"
          :key="index"
          style="margin: 0 0 10px 0; font-size: 18px"
          >{{ item }}
        </li>
      </ul>
    </center>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="dblclicksShowA4 = false">取消</el-button>
        <el-button v-if="dataShow" type="primary" @click="saveZjtA5" :loading="drawLoading">
          确认
        </el-button>
        <el-button v-else type="primary" @click="saveZjtA4"> 确认 </el-button>
      </span>
    </template>
  </el-dialog>
  <el-dialog v-model="machineNumberPopover" :width="800" title="选择规则">
    <div style="width: 100%; height: 500px">
      <encapsulation-agrid ref="refgridOption3" :configaggrid="configaggrid3"></encapsulation-agrid>
    </div>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="machineNumberPopover = false">取消</el-button>
        <el-button type="primary" @click="machineNumberOk"> 确定 </el-button>
      </span>
    </template>
  </el-dialog>
  <!-- 打印织布变更单 -->
  <a-modal
    draggable
    :visible="BGvisible"
    @ok="BGhandleOk"
    @cancel="BGvisible = false"
    okText="打印"
    cancelText="关闭"
    unmountOnClose
    :width="787"
  >
    <template #title> 打印织布变更单</template>
    <div id="Weaving" class="isZbous">
      <h1 style="width: 100%; text-align: center" class="isZbouss">织布变更单</h1>
      <div v-for="item in idList" style="width: 100%">
        <span style="margin-right: 10%">织布单号:{{ item.planOrderCode }}</span>
        <span style="margin-right: 10%">变更单号:{{ item.weavClothCode }}</span>
        <span>客户名称:{{ item.customName }}</span
        ><br />

        <span style="margin-right: 23%">原重量:{{ item.oldOrderWeight }}</span>
        <span style="margin-right: 21%">变更重量:{{ item.orderWeight }}</span>
        <span>变更的重量:{{ item.totleNum }}</span
        ><br />

        <span style="margin-right: 10%">织厂:{{ item.outSouringCompany }}</span>
        <span style="margin-right: 10%">开单日期:{{ item.planDate }}</span>
        <span style="margin-right: 10%">完成日期:{{ item.weavDeliveryDate }}</span>
        <span>织工:</span>
      </div>
      <table class="isTable">
        <tr v-for="item in idList">
          <td>营销部门</td>
          <td></td>
          <td>计划类型</td>
          <td :colspan="3">{{ item.businessType }}</td>
          <td>生产单号</td>
          <td>{{ item.weaveCode }}</td>
        </tr>
        <tr>
          <td>编号</td>
          <td v-for="item in idList5">{{ item.greyCode }}</td>
          <td>品名</td>
          <td :colspan="3" v-for="item in idList" style="width: 200px; word-wrap: break-word">{{
            item.greyName
          }}</td>
          <td>颜色</td>
          <td v-for="item in idList">{{ item.colorName }}</td>
        </tr>
        <tr v-for="item in idList">
          <td>机型</td>
          <td>{{ item.machineType }}</td>
          <td>针寸数</td>
          <td :colspan="3">{{ item.workDrum }}</td>
          <td>抽针/圆筒</td>
          <td>{{ item.drawnNeedleState === 0 ? '抽针' : '圆筒' }}</td>
        </tr>
        <tr v-for="item in idList">
          <td>批号</td>
          <td>{{ item.greyBatchNo }}</td>
          <td>匹数</td>
          <td>{{ item.pieceNum }}</td>
          <td>重量</td>
          <td>{{ item.totleNum }}</td>
          <td>打卷类型</td>
          <td>{{ item.type === 0 ? '开幅' : '不开幅' }}</td>
        </tr>
        <tr v-for="item in idList">
          <td>成品布号</td>
          <td>{{ item.productColthCode }}</td>
          <td>织损</td>
          <td :colspan="3">{{ item.lossRate }}</td>
          <td>匹重</td>
          <td>25斤/匹</td>
        </tr>
      </table>
      <table class="isTable">
        <tr>
          <td :colspan="7">使用材料及比例</td>
        </tr>
        <tr>
          <td>材料名称</td>
          <td>品牌</td>
          <td>批次</td>
          <td>色号/色称</td>
          <td>比例</td>
          <td>可发纱量(KG)</td>
          <td>注释</td>
        </tr>
        <tr v-for="item in idList2">
          <td>{{ item.rawmaterialName }}</td>
          <td>{{ item.yarnCard }}</td>
          <td>{{ item.batch }}</td>
          <td>{{ item.colorCode + '/' + item.colorName }}</td>
          <td>{{ item.yarnProportion }}</td>
          <td>{{ item.canDeliveryYarnNum }}</td>
          <td>{{ item.orderCaption }}</td>
        </tr>
      </table>
      <table class="isTable" style="width: 80%; float: left">
        <tr>
          <td style="width: 30px">工艺要求</td>
          <td style="height: 500px; width: 500px; text-align: left">
            <div>
              <span v-if="dataForm.machineType != '单面机'">上排</span>
              <span v-if="dataForm.machineType === '单面机'">排针</span>
              <input
                disabled
                v-for="(item, index) in zzpzdata"
                :key="index"
                style="width: 28px; height: 35px; border: 1px solid black"
                v-model="item.upBasin"
              />
            </div>
            <div v-if="dataForm.machineType != '单面机'">
              <span
                :style="{
                  'padding-right': dataForm.machineType === '螺纹机' ? '35px' : '5px',
                }"
                >下排</span
              >
              <input
                disabled
                v-for="(item, index) in zzpzdata"
                :key="index"
                style="width: 20px; border: 1px solid black; text-align: center"
                v-model="item.belowBasin"
              />
            </div>
            <span v-for="item in idList">{{ item.colorName }}</span
            ><br />
            <div
              v-for="(item, index) in idList4.sj as any"
              style="text-align: center; width: 100%; overflow-x: auto"
            >
              <div
                style="
                  text-align: center;
                  color: #165dff;
                  font-size: 16px;
                  background-color: aliceblue;
                  border-bottom: 0.5px solid #ccc;
                "
              >
                {{ item.type }}
              </div>
              <div class="thead" style="background-color: aliceblue">
                <div class="th" style="width: 50px">序号</div>
                <div class="th" style="width: 200px">用针</div>
                <div
                  class="th"
                  style="width: 18px; font-size: 5px"
                  v-for="i2 in item.typeData[0].needleList"
                  :key="i2.way"
                >
                  {{ i2.way }}
                </div>
              </div>
              <div class="tbody" v-for="i1 in item.typeData">
                <div class="td" style="width: 50px; font-size: 5px">{{ i1.serialNumber }}</div>
                <div class="td" style="width: 200px">
                  <span style="font-size: 3px">{{ i1.needleName }}</span>
                </div>
                <div
                  class="td"
                  style="width: 18px; font-size: 3px; border: 1px solid gray"
                  v-for="i2 in i1.needleList"
                >
                  <div style="width: 100%; height: 100%">
                    {{ tags.filter((o) => o.id === i2.needle)[0]?.val }}
                  </div>
                </div>
              </div>
            </div>
            <div style="display: flex; align-items: center">
              <div style="width: 50%">
                <span>裁口排针</span>
                <a-input disabled v-model="ckpzobj.pinHeader"></a-input>
              </div>
            </div>
          </td>
        </tr>
        <tr>
          <td>注意事项</td>
          <td style="height: 30px"></td>
        </tr>
      </table>
      <table class="isTable3" style="width: 20%; float: right" v-for="item in idList">
        <tr>
          <td :colspan="2" style="border-bottom: 1px solid #ccc">备注</td>
        </tr>
        <tr>
          <td
            style="
              height: 350px;
              width: 100%;
              float: left;
              border-bottom: 1px solid #ccc;
              text-align: left;
            "
            >{{ item.remark }}
          </td>
          <td style="height: 217px; width: 100%; float: right; text-align: left"
            >机台号:{{ item.schedulMachineCode }}</td
          >
        </tr>
      </table>
      <div v-for="item in idList" style="width: 100%">
        <span>制单人:{{ item.tabulationPerson }}</span>
        <span style="margin-left: 120px">制单时间:{{ item.planDate }}</span>
        <span style="margin-left: 120px">审核:</span>
      </div>
    </div>
  </a-modal>

  <!-- 打印通知单 -->
  <a-modal
    v-model:visible="ZBvisible"
    ok-text="打印"
    cancelText="关闭"
    @ok="ZBhandleOk"
    :width="800"
  >
    <template #title> 织布通知单 </template>
    <div class="isZbous" id="order">
      <div class="isZbouss">生产通知单</div>
      <div class="isZbouss1">
        <span>织厂:{{ isDatasShuju.outSouringCompany }}</span>
        <span>客户订单号:{{ isDatasShuju.customOrderNo }}</span>
        <span class="isZbouss1-1">试纱单</span>
      </div>
      <div class="isZbouss2">
        <span>
          <span>开单日期:{{ isDatasShuju.planDate }}</span
          ><span></span>
        </span>
        <span>
          <span>织造交期:{{ isDatasShuju.weavDeliveryDate }}</span
          ><span></span>
        </span>
      </div>
      <table class="isTable">
        <tr>
          <td colspan="2">客户名称</td>
          <td colspan="4">{{ isDatasShuju.customName }}</td>
          <td colspan="2">织布单号</td>
          <td colspan="4">{{ isDatasShuju.planOrderCode }}</td>
          <td colspan="2">生产单号</td>
          <td colspan="4"></td>
        </tr>
        <tr>
          <td colspan="2">坯布编号</td>
          <td colspan="4">{{ isDatasShuju.greyCode }}</td>
          <td colspan="2">坯布名称</td>
          <td colspan="4">{{ isDatasShuju.greyName }}</td>
          <td colspan="2">可配色称</td>
          <td colspan="4">{{ isDatasShuju.matchColor }}</td>
        </tr>
        <tr>
          <td colspan="2">机型</td>
          <td colspan="4">{{ isDatasShuju.grey[0].machineType }}</td>
          <td colspan="2">针寸数</td>
          <td colspan="4">{{ isDatasShuju.workDrum }}</td>
          <td colspan="2">是否抽针</td>
          <td colspan="4">{{ isDatasShuju.drawnNeedleState == 0 ? '抽针' : '否' }}</td>
        </tr>
        <tr>
          <td colspan="2">坯布批号</td>
          <td colspan="4">{{ isDatasShuju.greyBatchNo }}</td>
          <td colspan="2">指令重量</td>
          <td colspan="4">{{ isDatasShuju.orderWeight }}公斤</td>
          <td colspan="2">包装类型</td>
          <td colspan="4">{{ isDatasShuju.type }}</td>
        </tr>
        <tr>
          <td colspan="2">商品号</td>
          <td colspan="4">{{ isDatasShuju.productColthCode }}</td>
          <td colspan="2">匹数</td>
          <td colspan="4">{{ isDatasShuju.pieceNum }}</td>
          <td colspan="2">成品门幅</td>
          <td colspan="4">{{ isDatasShuju.width }}</td>
        </tr>
        <tr>
          <td colspan="2">成品克重</td>
          <td colspan="10">{{ isDatasShuju.weight }}</td>
        </tr>
        <tr>
          <td colspan="2">用纱代码</td>
          <td colspan="2">原料名称</td>
          <td colspan="2">纱牌</td>
          <td colspan="2">纱批</td>
          <td colspan="2">色号/色称</td>
          <td colspan="2">用纱比例</td>
          <td colspan="2">织损</td>
          <td colspan="2">可发纱量</td>
        </tr>
        <tr v-for="item in isDatasShuju.planOrderRawmaterials">
          <td colspan="2">{{ item.rawmaterialCode }}</td>
          <td colspan="2">{{ item.rawmaterialName }}</td>
          <td colspan="2" style="width: 60px">{{ item.yarnCard }}</td>
          <td colspan="2">{{ item.batch }}</td>
          <td colspan="2">{{ item.colorCode + '/' + item.colorName }}</td>
          <td colspan="2">{{ item.yarnProportion }}</td>
          <td colspan="2">{{ item.weaveLoss }}</td>
          <td colspan="2">{{ item.canDeliveryYarnNum }}</td>
        </tr>
      </table>
      <div class="gyYaoqiu">工艺要求</div>
      <div class="gyYaoqius">
        <div style="width: 100%; overflow: auto">
          <div>
            <span style="padding: 5px" v-if="dataForm.machineType != '单面机'">上排</span>
            <span style="padding: 5px" v-if="dataForm.machineType === '单面机'">排针</span>
            <input
              disabled
              v-for="(item, index) in zzpzdata"
              :key="index"
              style="width: 30px; border: 1px solid black; padding: 5px; text-align: center"
              v-model="item.upBasin"
            />
          </div>
          <div v-if="dataForm.machineType != '单面机'">
            <span
              style="padding: 5px"
              :style="{
                'padding-right': dataForm.machineType === '螺纹机' ? '35px' : '5px',
              }"
              >下排</span
            >
            <input
              disabled
              v-for="(item, index) in zzpzdata"
              :key="index"
              style="width: 30px; border: 1px solid black; padding: 5px; text-align: center"
              v-model="item.belowBasin"
            />
          </div>
        </div>
        <div
          v-for="(item, index) in sjdata.sj as any"
          style="text-align: center; margin: 20px auto; width: 100%; overflow-x: auto"
        >
          <div
            style="
              text-align: center;
              color: #165dff;
              font-size: 16px;
              background-color: aliceblue;
              border-bottom: 0.5px solid #ccc;
            "
          >
            {{ item.type }}
          </div>

          <div class="thead" style="background-color: aliceblue">
            <div class="th" style="width: 50px">序号</div>
            <div class="th" style="width: 250px">用针</div>
            <div
              class="th"
              style="width: 22px"
              v-for="i2 in item.typeData[0].needleList"
              :key="i2.way"
            >
              {{ i2.way }}
            </div>
          </div>
          <div class="tbody" v-for="i1 in item.typeData">
            <div class="td" style="width: 50px">{{ i1.serialNumber }}</div>
            <div class="td" style="width: 250px">
              <a-input disabled v-model="i1.needleName"></a-input>
            </div>
            <div
              class="td"
              style="width: 22px; font-size: 5px; border: 1px solid gray"
              v-for="i2 in i1.needleList"
            >
              <div style="width: 100%; height: 100%"
                >{{ tags.filter((o) => o.id === i2.needle)[0]?.val }}
              </div>
            </div>
          </div>
        </div>
        <div class="tbody" style="margin-top: 10px">
          <div
            style="
              text-align: center;
              color: #165dff;
              font-size: 16px;
              background-color: aliceblue;
              border-bottom: 0.5px solid #ccc;
            "
          >
            排纱
          </div>
          <div v-for="(item, index) in psList" class="trow">
            <div
              style="border: 1px solid #ccc; height: 30px; box-sizing: border-box"
              v-for="(item1, index1) in item"
            >
              <input
                disabled
                v-model="item1.val"
                v-if="
                  !((index > 0 && (index1 == 0 || index1 == 1)) || (index == 0 && index1 === 2))
                "
                style="width: 50px; vertical-align: top; height: 100%; text-align: center"
                :class="{ active: index1 == 0 || index1 == 1 }"
              />
              <div
                v-if="(index > 0 && (index1 == 0 || index1 == 1)) || (index == 0 && index1 === 2)"
                style="width: 50px; vertical-align: top; height: 100%; text-align: center"
                :class="{ active: index1 == 0 || index1 == 1 }"
                >{{ item1.val }}
              </div>
            </div>
          </div>
        </div>
        <div style="display: flex; align-items: center">
          <div style="width: 50%">
            <span>裁口排针</span>
            <a-input disabled v-model="ckpzobj.pinHeader"> </a-input>
          </div>
          <div style="width: 50%">
            <span>纱线排列</span>
            <a-input disabled v-model="ckpzobj.arrangement"> </a-input>
          </div>
        </div>
      </div>
      <table class="isTable">
        <tr>
          <td>实际参数</td>
          <td>齿轮</td>
          <td>布架宽度</td>
          <td>底座垫片</td>
          <td :style="{ width: '160px', textAlign: 'left' }">机速:</td>
          <td :style="{ width: '160px', textAlign: 'left' }">实开模板:</td>
        </tr>
        <tr>
          <td></td>
          <td>{{
            isDatasShuju.machineStandard.length != 0 ? isDatasShuju.machineStandard[0].gear : ''
          }}</td>
          <td
            >{{
              isDatasShuju.machineStandard.length != 0
                ? isDatasShuju.machineStandard[0].clothRackWidth
                : ''
            }}
          </td>
          <td
            >{{
              isDatasShuju.machineStandard.length != 0
                ? isDatasShuju.machineStandard[0].baseGasket
                : ''
            }}
          </td>
          <td :style="{ width: '160px', textAlign: 'left' }">布架活动胶:</td>
          <td :style="{ width: '160px', textAlign: 'left' }">针盘高度:</td>
        </tr>
        <tr>
          <td>布架张力A-D</td>
          <td>布架张力1-16</td>
          <td>送纱盘-面盘</td>
          <td>送纱盘-中盘</td>
          <td :style="{ width: '160px', textAlign: 'left' }">布架张力:</td>
          <td :style="{ width: '160px', textAlign: 'left' }">布架幅宽:</td>
        </tr>
        <tr>
          <td
            >{{
              isDatasShuju.machineStandard.length != 0
                ? isDatasShuju.machineStandard[0].clothTensionAD
                : ''
            }}
          </td>
          <td
            >{{
              isDatasShuju.machineStandard.length != 0
                ? isDatasShuju.machineStandard[0].clothTensionOS
                : ''
            }}
          </td>
          <td
            >{{
              isDatasShuju.machineStandard.length != 0
                ? isDatasShuju.machineStandard[0].sandTableSurfacePlate
                : ''
            }}
          </td>
          <td
            >{{
              isDatasShuju.machineStandard.length != 0
                ? isDatasShuju.machineStandard[0].sandTrayMiddlePlate
                : ''
            }}
          </td>
          <td :style="{ width: '160px', textAlign: 'left' }">下机克重:</td>
          <td :style="{ width: '160px', textAlign: 'left' }">下机封度:</td>
        </tr>
        <tr>
          <td>送纱盘-底盘</td>
          <td>争食</td>
          <td>分食</td>
          <td>不争不分</td>
          <td :style="{ width: '160px', textAlign: 'left' }">织针型号:</td>
          <td rowspan="4">{{
            isDatasShuju.planMachineCode ? isDatasShuju.planMachineCode : ''
          }}</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td
            >{{
              isDatasShuju.machineStandard.length == 0
                ? ''
                : isDatasShuju.machineStandard[0].dodge == 1
                ? '√'
                : ''
            }}
          </td>
          <td
            >{{
              isDatasShuju.machineStandard.length == 0
                ? ''
                : isDatasShuju.machineStandard[0].broken == 1
                ? '√'
                : ''
            }}
          </td>
          <td
            >{{
              isDatasShuju.machineStandard.length == 0
                ? ''
                : isDatasShuju.machineStandard[0].allTrue == 1
                ? '√'
                : ''
            }}
          </td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>织针型号</td>
          <td>织针1段</td>
          <td>织针2段</td>
          <td>织针3段</td>
          <td>织针需求等级</td>
        </tr>
        <tr>
          <td
            >{{
              isDatasShuju.machineStandard.length != 0
                ? isDatasShuju.machineStandard[0].needleModel
                : ''
            }}
          </td>
          <td
            >{{
              isDatasShuju.machineStandard.length == 0
                ? ''
                : isDatasShuju.machineStandard[0].needleOnePerod == 1
                ? '√'
                : ''
            }}
          </td>
          <td
            >{{
              isDatasShuju.machineStandard.length == 0
                ? ''
                : isDatasShuju.machineStandard[0].needleTwoPerod == 1
                ? '√'
                : ''
            }}
          </td>
          <td
            >{{
              isDatasShuju.machineStandard.length == 0
                ? ''
                : isDatasShuju.machineStandard[0].needleThreePerod == 1
                ? '√'
                : ''
            }}
          </td>
          <td
            >{{
              isDatasShuju.machineStandard.length != 0
                ? isDatasShuju.machineStandard[0].needleGrade
                : ''
            }}
          </td>
        </tr>
        <tr>
          <td class="trTds">计划单备注</td>
          <td colspan="5">{{ isDatasShuju.remark ? isDatasShuju.remark : '' }}</td>
        </tr>
        <tr>
          <td class="trTds">工艺备注</td>
          <td colspan="5">{{ isDatasShuju.otherRemark ? isDatasShuju.otherRemark : '' }}</td>
        </tr>
      </table>
      <div class="footers">
        <div>
          <span>制单:{{ isDatasShuju.tabulationPerson ? isDatasShuju.tabulationPerson : '' }}</span>
          <span>制单时间:{{ isDatasShuju.planDate ? isDatasShuju.planDate : '' }}</span>
          <span>审核:{{ isDatasShuju.auditPerson ? isDatasShuju.auditPerson : '' }}</span>
        </div>
      </div>
    </div>
  </a-modal>
</template>
<script setup lang="ts">
  import { ref, reactive, onMounted, nextTick } from 'vue'
  // import { tableColumns2 } from './useTables/todouTables'
  import {
    useTable,
    useRowKey,
    useTableColumn,
    usePagination,
    useRowSelection,
  } from '@/hooks/table'
  import { post, get } from '@/api/http'
  import { IconDoubleUp, IconDoubleDown, IconEdit } from '@arco-design/web-vue/es/icon'
  import { Cascader, Message, Modal } from '@arco-design/web-vue'
  import { FormInstance } from '@arco-design/web-vue/es/form'

  import { localeText } from '@/api/aggridZw'
  import CorporateSectorCascader from '@/components/corporateSectorCascader/inde.vue'
  import usePermission from '@/store/modules/permission'
  import dayjs from 'dayjs'
  import { tableColumnsjth } from './newschedulelist'
  import tagRender from '@/components/aggridCellRenDerer/tagRender.vue'
  import { useRoute } from 'vue-router'
  import printJS from 'print-js'
  import emitter from '@/hooks/useEventBus'
  import { saveOrUpdateGridState as saveOrUpdateGridState01 } from '@/hooks/useGridState'
  import { saveOrUpdateGridState as saveOrUpdateGridState02 } from '@/hooks/useGridState'
  import { saveOrUpdateGridState as saveOrUpdateGridState03 } from '@/hooks/useGridState'
  import { saveOrUpdateGridState as saveOrUpdateGridState04 } from '@/hooks/useGridState'
  import { slicing } from '@/utils/caseFrimAndSecRig'
  import inputRender from '@/components/aggridCellRenDerer/inputRender.vue'

  const route = useRoute()
  const addLoding: any = ref(false)
  const gridOption: any = ref()
  const colState = ref()
  const gridReady = (params: any) => {
    gridOption.value = params.api
    colState.value = params.columnApi
  }
  const gridOptionyasda = ref()
  const colState3 = ref()
  const gridReadyasda = (params: any) => {
    gridOptionyasda.value = params.api
    colState3.value = params.columnApi
  }
  const selectedRow = ref([])
  const clickRow = () => {
    selectedRow.value = gridOptionyasda.value.getSelectedRows()
    console.log(selectedRow.value)
  }
  // 引入element提示
  import { ElMessage, ElMessageBox } from 'element-plus'
  // 页签
  const active: any = ref<string | Number>('2')
  active.value = route.query.key || '2'
  // 变更弹窗数据
  const ChangeButtonForm = ref<any>({
    number1: 1,
    number: 1,
  })
  // 变更弹窗显示变量
  const ChangeButtonVisible = ref(false)
  // 页签选择事件
  const activeChange = (val: string | Number) => {
    active.value = val
    if (val == 2) selectHandler()
    if (val == 0 || val == 1) {
      user()
      getList()
    }
  }
  // 重量输入事件
  const changeInput = (val: any) => {
    var changeW = Number(val).toFixed(0)
    if (Number(changeW) < Number(-ChangeButtonForm.value.orderWeight)) {
      ChangeButtonForm.value.changeWeight = Number(-ChangeButtonForm.value.orderWeight)
    } else {
      ChangeButtonForm.value.changeWeight = Number(changeW)
    }

    ChangeButtonForm.value.changeOrderWeight =
      Number(ChangeButtonForm.value.changeWeight) + Number(ChangeButtonForm.value.orderWeight)
    let cie =
      Number(ChangeButtonForm.value.changeOrderWeight) / Number(ChangeButtonForm.value.pieceWeight)
    ChangeButtonForm.value.changePieceNum = Math.ceil(cie)
  }
  //变更保存按钮
  const handleBeforeOk = async () => {
    const { changeWeight, changeWeavDeliveryDate, changeWeavDeliveryDateweavDeliveryDate } =
      ChangeButtonForm.value
    if (changeWeight == 0 && changeWeavDeliveryDate == changeWeavDeliveryDateweavDeliveryDate) {
      Message.error('请先勾选单据')
      return false
    }
    try {
      pageData.pageLoading = true
      let data = {
        planOrderCode: ChangeButtonForm.value.planOrderCode,
        changeWeight: ChangeButtonForm.value.changeWeight,
        changeDate: dayjs(ChangeButtonForm.value.changeWeavDeliveryDate).format(
          'YYYY-MM-DD HH:mm:ss'
        ),
        changePieceNum: ChangeButtonForm.value.changePieceNum,
      }
      let { code, message } = await post({
        url: 'planSingle/planOrderChange/insertPlanOrderChange',
        data,
      })
      if (code == 200) {
        pageData.pageLoading = false
        ChangeButtonVisible.value = false
        Message.success('保存成功')
        selectHandler()
        return
      }
      Message.error(message)
    } finally {
      pageData.pageLoading = false
    }
  }
  //变更按钮
  const ChangeButton = async () => {
    if (gridOption.value.getSelectedRows().length === 0) {
      Message.error('请先勾选单据')
      return
    }
    if (gridOption.value.getSelectedRows().length != 1) {
      Message.error('只能勾选一条单据')
      return
    }
    if (gridOption.value.getSelectedRows()[0].schedulState == 3) {
      Message.error('订单完结不能变更')
      return
    }
    if (gridOption.value.getSelectedRows()[0].processType == 0) {
      Message.error('本集团订单不能变更')
      return
    }

    let arr = gridOption.value.getSelectedRows()
    if (arr[0].auditState == 0 && arr[0].schedulState == 0) {
      Message.error('未提交，未排产状态下，不能进行变更')
      return
    }
    // if (
    //   arr.some((item: any) => {
    //     return item.schedulState == 4
    //   })
    // ) {
    //   Message.error('订单完结不能再次完结')
    //   return
    // }
    // let selectList = gridOption.value.getSelectedRows()[0]
    // try {
    //   pageData.pageLoading = true
    //   let { code, data, message } = await get({
    //     url:
    //       'planSingle/planOrder/getChangeDialogInfoByPlanCode?planOrderCode=' +
    //       selectList.planOrderCode,
    //   })
    //   if (code == 200) {
    //     ChangeButtonForm.value = data
    //     ChangeButtonForm.value.changeWeavDeliveryDate = ChangeButtonForm.value.weavDeliveryDate
    //     ChangeButtonForm.value.changeWeight = 0
    //     changeInput(0)
    //     pageData.pageLoading = false
    //     ChangeButtonVisible.value = true
    //     return
    //   }
    //   Message.error(message)
    // } finally {
    //   pageData.pageLoading = false
    // }
    // let val = gridOption.value.getSelectedRows()[0]
    post({
      url: 'planSingle/planOrderChange/getOrderChangeInfo',
      data: { id: gridOption.value.getSelectedRows()[0].id },
    }).then((res: any) => {
      if (res.code == 200) {
        let val = res.data
        loadings.value = true
        pibuArray.pibu1 = val.greyBatchNo.split('-')[0]
        pibuArray.pibu2 = val.greyBatchNo.split('-')[1]
        post({
          url: 'planSingle/planOrder/getRawmaterialInfo',
          data: val.id,
        }).then(async (res: any) => {
          if (res.code == 200) {
            datasList.value = res.data
            await renderTableDateList(datasList.value)
            tableDateList_1.value = res.data
            tableDateList_1.value.forEach((e: any) => {
              e['yarnUnits'] = e['yarnUnit']
            })
          } else {
            Message.error('获取原料信息失败')
          }
        })
        post({
          url: 'product/pdGreyInformation/selectpdGreyInformation',
          data: {
            grayFabricName: val.greyName,
          },
        }).then((res: any) => {
          if (res.code == 200) {
            // dataForm1.widthState = Number(res.data[0].scutchingState)
            dataForm1.widthState = Number(val.type)
            dataForm1.weavRemark = res.data[0].weavingNote
            isDatasList.value = res.data
            jiTypes.value = res.data[0].machineType
            let idsDta
            let organizationPinId
            let arrangementId
            let cutMouthNeedleId
            isDatasList.value.forEach((res: any) => {
              if (res.greyCode == val.greyCode) {
                idsDta = res.id
                organizationPinId = res.organizationPinId
                arrangementId = res.arrangementId
                cutMouthNeedleId = res.cutMouthNeedleId
                dataForm1.machineType = res.machineType
                dataForm1.greyId = res.id
                post({
                  url: 'product/pdGreyInformation/select',
                  data: {
                    id: idsDta,
                  },
                }).then(({ code, data }) => {
                  if (code === 200) {
                    dataForm1.weavRemark = data.greyInformation.weavingNote
                    dataForm1.productColthCode = data.greyInformation.popularizeCommodity
                    machineTypeXZ.value = data.greyInformation.machineType
                    // 组织排针 数据
                    zzpzdata.value =
                      data.organizationPinSons.length == 0
                        ? [
                            {
                              upBasin: '',
                              belowBasin: '',
                              id: '',
                              pdOrganizationPinId: '',
                            },
                          ]
                        : data.organizationPinSons
                    // 裁口排针
                    if (data.cuttingMouthNeedleGrey != null) {
                      let cuttingMouthNeedleGrey = data.cuttingMouthNeedleGrey
                      ckpzobj.id = cuttingMouthNeedleGrey.id
                      ckpzobj.pinHeader = cuttingMouthNeedleGrey.pinHeader
                      ckpzobj.arrangement = cuttingMouthNeedleGrey.arrangement
                    }
                    //tw加
                    if (
                      data.cuttingMouthNeedleGrey != null &&
                      data.cuttingMouthNeedleGrey.length > 0
                    ) {
                      ckpzobj.pinHeader = data.cuttingMouthNeedleGrey[0].pinHeader
                      ckpzobj.arrangement = data.cuttingMouthNeedleGrey[0].arrangement
                      // ckpzid.value = data.cuttingMouthNeedleGrey[0].cmdName
                    }
                    // 排三角arrangementTriangleGreys
                    sjdata.sj = data.arrangementTriangleGreys.info
                    // sjdata.sjid=data.arrangementTriangleGreys.greyId
                    // psjpb.value=data.arrangementTriangleGreys.greyId 现有坯布
                    sjdata.atCode = data.arrangementTriangleGreys.atCode
                    sjdata.atName = data.arrangementTriangleGreys.atName
                    sjdata.remark = data.arrangementTriangleGreys.remark
                    psList.value = data.atOther
                  } else {
                    Message.error('获取原料失败')
                  }
                })
              }
            })
          } else {
            Message.error('获取失败')
          }
        })
        doRefreshs(val.id)
        setTimeout(() => {
          cascaderRef2.value?.parentComponent({
            corporateId: val.verifyClothCompanyId,
          })
          for (let item in val) {
            dataForm1[item] = val[item]
            if (item == 'computeMode') {
              dataForm1.computeMode = val['computeMode'] == 0 ? '条距' : '路数'
            }
          }
          dataForm1.widthState = Number(val.type)
          checked.value = dataForm1['urgentState'] == 0 ? false : true
          checked2.value = dataForm1['tryYarnState'] == 0 ? false : true
          loadings.value = false
          handleReturnShow.value = false
          ChangeButtonVisible.value = true
          dataForm1.orderChangeWeight = dataForm1.orderWeight + dataForm1.changeWeight
          dataForm1.amount = dataForm1.orderChangeWeight * dataForm1.price
          pageData.sideTitle = '织布单变更'
          nextTick(() => {
            cc(val)
          })
        }, 100)
      }
    })
  }
  const gridOption1 = ref()
  const colState2 = ref()
  const gridReady1 = (params: any) => {
    gridOption1.value = params.api
    colState2.value = params.columnApi
  }
  const gridOption3 = ref()
  const colState4 = ref()
  const gridReady3 = (params: any) => {
    gridOption3.value = params.api
    colState4.value = params.columnApi
  }
  let refgridOption3 = ref<any>()
  const selectrows = ref({
    planOrderCode: '',
    planId: '',
    orderWeight: '',
    greyName: '',
    greyCode: '',
    weavDeliveryDate: '',
    greyId: '',
    productType: '',
    productKind: '',
    orderWeightNew: '',
    oldOrderWeight: '',
    schedulState: null,
  })
  let configaggrid3 = ref({
    url: 'planSingle/planSchedul/getAutoScheduleInfo', //接口路径
    queryData: {
      planOrderCode: selectrows.value.planOrderCode,
      // gridOption1.value.getSelectedRows()[0]
      planOrderId: selectrows.value.planId,
      schedulState: 50,
    },
    paginationShow: true, //分页是否显示
    invokeiIterface: false, //是否调用接口
    rowMultiSelectWithClick: true, //点击行是否多选
    column: [
      {
        headerCheckboxSelection: true,
        checkboxSelection: true,
        width: 50,
        showDisabledCheckboxes: false,
        pinned: 'left',
      },
      {
        headerName: '机台号',
        field: 'coordinate',
        width: 180,
      },
      {
        headerName: '楼层',
        field: 'areaName',
        width: 180,
      },
      {
        headerName: '公司',
        field: 'firm',
        width: 300,
      },
    ],
  })
  //机台号弹窗
  const machineNumberPopover = ref(false)
  //规则数据
  const addWeightRadio = ref<string>('1')
  //最后提交完成再掉一次接口
  const over = async () => {
    try {
      // pageData.addWeightLoading = true
      let { code, message } = await post({
        url: 'planSingle/planOrderChange/submit',
        data: { over: '1' },
      })
      if (code == 200) {
        // addWeightDialog.value = false
        return
      }
      Message.error(message)
    } finally {
      // pageData.addWeightLoading = false
    }
  }
  // 规则提交
  const addWeightOk = async () => {
    if (addWeightRadio.value == '1') {
      try {
        pageData.addWeightLoading = true
        let { code, message } = await post({
          url: 'planSingle/planSchedul/getPlanOrderChangeAdd',
          data: {
            id: selectrows.value.planId,
            planOrderCode: selectrows.value.planOrderCode.split('/')[0],
            weight: selectrows.value.orderWeight,
            greyCode: selectrows.value.greyCode,
            greyName: selectrows.value.greyName,
          },
        })
        if (code == 200) {
          Message.success('提交成功')
          over()
          getList()
          pageData.addWeightLoading = false
          addWeightDialog.value = false
          return
        }
        Message.error(message)
      } finally {
        pageData.addWeightLoading = false
      }
    } else {
      productionSchedulingAndPreservation('')
    }
  }
  // 试算数据
  const shisuanList = ref([])
  //试算接口
  const shisun = async () => {
    if (machineList.value.length == 0) {
      Message.error('请选择规则')
      return
    }
    try {
      pageData.addWeightLoading = true
      let { code, message, data } = await post({
        url: 'planSingle/planSchedul/getScheduleCalculateChange',
        data: {
          planOrderId: selectrows.value.planId,
          planOrderCode: selectrows.value.planOrderCode.split('/')[0],
          // weight: selectrows.value.orderWeight,
          greyId: selectrows.value.greyId,
          greyCode: selectrows.value.greyCode,
          greyName: selectrows.value.greyName,
          productType: selectrows.value.productType,
          weavDeliveryDate: dayjs(selectrows.value.weavDeliveryDate).format('YYYY-MM-DD'),
          calculateData: [],
          machine: machineList.value,
          orderWeightNew: Math.abs(Number(selectrows.value.orderWeight)),
        },
      })
      if (code == 200) {
        // over()
        pageData.addWeightLoading = false
        // console.log(data)
        shisuanList.value = data
        refgridOption2.value.setdataListIterface(data)
        // productionSchedulingAndPreservation(data)
        return
      }
      Message.error('试算失败')
    } finally {
      pageData.addWeightLoading = false
    }
  }
  //选择机台号
  const Machine = () => {
    machineNumberPopover.value = true
    nextTick(() => {
      refgridOption3.value.setQuery({
        planOrderCode: selectrows.value.planOrderCode,
        planOrderId: selectrows.value.planId,
        schedulState: 50,
      })
    })
  }
  //删除机台号
  const deleteInventory = () => {
    const selectedData = refgridOption2.value.getSelectedRows()
    if (selectedData.length == 0) {
      ElMessage.warning('请勾选您要删除的机台号')
      return
    }
    ElMessageBox.confirm('确认删除选中机台号?', '提示', {
      confirmButtonText: '确认',
      cancelButtonText: '取消',
      type: 'warning',
    })
      .then(() => {
        refgridOption2.value.applyTransaction({ remove: selectedData })
        ElMessage({
          type: 'success',
          message: '删除成功',
        })
      })
      .catch(() => {})
  }
  // 选择的机台号
  let refgridOption2 = ref<any>()
  let configaggrid2 = ref({
    url: '', //接口路径
    paginationShow: false, //分页是否显示
    invokeiIterface: false, //是否调用接口
    rowMultiSelectWithClick: true, //点击行是否多选
    column: tableColumnsjth,
    queryData: {
      warehouseTypeName: '坯布仓',
    },
  })
  //排产保存
  const productionSchedulingAndPreservation = async (data: any) => {
    if (shisuanList.value.length == 0) {
      ElMessage.warning('请选择机台号')
      return
    }
    try {
      pageData.addWeightLoading = true
      let { code, message } = await post({
        url: 'planSingle/planSchedul/getScheduleSave',
        data: {
          changeId: gridOption1.value.getSelectedRows()[0].id,
          planOrderId: selectrows.value.planId,
          planOrderCode: selectrows.value.planOrderCode.split('/')[0],
          greyCode: selectrows.value.greyCode,
          greyName: selectrows.value.greyName,
          greyId: selectrows.value.greyId,
          after: [],
          save: shisuanList.value,
          schedulCode: '',
        },
      })
      if (code == 200) {
        Message.success('提交成功')
        getList()
        pageData.addWeightLoading = false
        addWeightDialog.value = false
        return
      }
      Message.error(message)
    } finally {
      pageData.addWeightLoading = false
    }
  }
  const machineList = ref([])
  //选择规则确定
  const machineNumberOk = () => {
    let arr3 = refgridOption3.value.getSelectedRows()
    if (arr3.length == 0) {
      Message.warning('请勾选您要选择的库存')
      return
    }
    machineList.value = arr3
    shisun()
    machineNumberPopover.value = false
    // console.log(refgridOption3.value.getSelectedRows())
  }
  //选择规则
  const addWeightChange = (val: string) => {
    // console.log(val)
    // if (val == '2') {
    //   machineNumberPopover.value = true
    //   nextTick(() => {
    //     refgridOption3.value.setQuery({
    //       planOrderCode: selectrows.value.planOrderCode,
    //       planOrderId: selectrows.value.planId,
    //       schedulState: 50,
    //     })
    //   })
    // }
  }
  //加大重量弹窗
  const addWeightDialog = ref(false)
  const contentLoading = ref(false)
  // 提交按钮
  const submit = async () => {
    if (
      active.value == 0
        ? gridOption1.value.getSelectedRows().length === 0
        : active.value == 1
        ? gridOptionyasda.value.getSelectedRows().length === 0
        : ''
    ) {
      Message.error('请先勾选单据')
      return
    }
    if (
      active.value == 0
        ? gridOption1.value.getSelectedRows().length != 1
        : active.value == 1
        ? gridOptionyasda.value.getSelectedRows().length != 1
        : ''
    ) {
      Message.error('只能勾选一条单据')
      return
    }
    selectrows.value = gridOption1.value.getSelectedRows()[0]
    if (gridOption1.value.getSelectedRows()[0].orderWeight < 0) {
      //待排状态
      Modal.confirm({
        title: '系统提示',
        content: '确认勾选的织布单是否提交?',
        onOk() {
          contentLoading.value = true
          post({
            url: 'planSingle/planOrderChange/submitChangeInfoRemove',
            data: gridOption1.value.getSelectedRows()[0],
          })
            .then((res: any) => {
              if (res.code === 200) {
                getList()
                Message.success('提交成功')
                contentLoading.value = false
              } else {
                Message.error(res.message)
                contentLoading.value = false
              }
            })
            .catch(() => {
              contentLoading.value = false
            })
        },
      })
    } else {
      if (
        gridOption1.value.getSelectedRows()[0].orderWeight == 0 ||
        (gridOption1.value.getSelectedRows()[0].orderWeight > 0 &&
          gridOption1.value.getSelectedRows()[0].schedulState == 0)
      ) {
        contentLoading.value = true
        post({
          url: 'planSingle/planOrderChange/submitChangeInfoAdd',
          data: {
            id: gridOption1.value.getSelectedRows()[0].id,
            infos: [],
            addSave: 1,
          },
        })
          .then(({ data, code, message }) => {
            if (code === 200) {
              Message.success('提交成功')
              contentLoading.value = false
              getList()
            } else {
              contentLoading.value = false
              Message.error(message)
            }
          })
          .catch(() => {
            contentLoading.value = false
          })
      } else {
        Modal.confirm({
          title: '系统提示',
          content: '确认勾选的织布单是否提交?',
          onOk() {
            dataShow.value = true
            contentLoading.value = true
            post({
              url: 'planSingle/planMachineTask/getPageInfo',
              data: {
                page: 1,
                size: 1000,
                planOrderCode: gridOption1.value.getSelectedRows()[0].planOrderCode,
              },
            })
              .then(({ data, code, message }) => {
                if (code === 200) {
                  tcA2DataList.value = data.list
                  dblclicksShowA2.value = true
                  contentLoading.value = false
                } else {
                  Message.error(message)
                  contentLoading.value = false
                }
              })
              .catch(() => {
                contentLoading.value = false
              })
          },
          // async onOk() {
          //   try {
          //     pageData.pageLoading = true
          //     let { code, message } = await post({
          //       url: 'planSingle/planOrderChange/submit',
          //       data: {
          //         planOrderCode:
          //           active.value == 0
          //             ? gridOption1.value.getSelectedRows()[0].planOrderCode
          //             : active.value == 1
          //               ? gridOptionyasda.value.getSelectedRows()[0].planOrderCode
          //               : '',
          //       },
          //     })
          //     if (code == 200) {
          //       Message.success('提交成功')
          //       getList()
          //       pageData.pageLoading = false
          //       return
          //     }
          //     if (code == 2001) {
          //       addWeightDialog.value = true
          //       addWeightRadio.value = '1'
          //       pageData.pageLoading = false
          //       machineList.value = []
          //       refgridOption2.value.setdataListIterface([])
          //       return
          //     }
          //     Message.error(message)
          //   } finally {
          //     pageData.pageLoading = false
          //   }
          // },
        })
      }
      // Modal.confirm({
      //   title: '系统提示',
      //   content: '确认勾选的织布单是否提交?',
      //   onOk() {
      //     dataShow.value = true
      //     post({
      //       url: 'planSingle/planMachineTask/getPageInfo',
      //       data:
      //       {
      //         page: 1,
      //         size: 1000,
      //         planOrderCode: gridOption1.value.getSelectedRows()[0].planOrderCode,
      //       },
      //     }).then(({ data, code, message }) => {
      //       if (code === 200) {
      //         tcA2DataList.value = data.list
      //         dblclicksShowA2.value = true
      //       } else {
      //         Message.error(message)
      //       }
      //     })
      //   },
      // async onOk() {
      //   try {
      //     pageData.pageLoading = true
      //     let { code, message } = await post({
      //       url: 'planSingle/planOrderChange/submit',
      //       data: {
      //         planOrderCode:
      //           active.value == 0
      //             ? gridOption1.value.getSelectedRows()[0].planOrderCode
      //             : active.value == 1
      //               ? gridOptionyasda.value.getSelectedRows()[0].planOrderCode
      //               : '',
      //       },
      //     })
      //     if (code == 200) {
      //       Message.success('提交成功')
      //       getList()
      //       pageData.pageLoading = false
      //       return
      //     }
      //     if (code == 2001) {
      //       addWeightDialog.value = true
      //       addWeightRadio.value = '1'
      //       pageData.pageLoading = false
      //       machineList.value = []
      //       refgridOption2.value.setdataListIterface([])
      //       return
      //     }
      //     Message.error(message)
      //   } finally {
      //     pageData.pageLoading = false
      //   }
      // },
      // })
    }
  }

  const dataShow = ref(false)
  const dataList = ref([])
  const getList = () => {
    // paginationA1.page = 1
    pageData.pageLoading = true
    post({
      url: 'planSingle/planOrder/getChangePageInfo',
      data: {
        page: paginationA1.page,
        size: paginationA1.pageSize,
        deleteState: 0,
        weaveCode: pageData.zxXh,
        planOrderCode: pageData.jhXh,
        customOrderNo: pageData.pbXh,
        customName: pageData.bmXh,
        businessPerson: pageData.ywy,
        changeState: active.value,
        outSouringCompanyId: pageData.outSouringCompanyId,
      },
    })
      .then(({ data, code }: any) => {
        pageData.pageLoading = false

        if (code === 200) {
          // gridOption.value.setRowData(data.list)
          console.log('datadata', data.list)
          dataList.value = data.list
          total.value = data.total
        }
      })
      .catch(console.log)
      .finally(() => {
        pageData.pageLoading = false
      })
  }
  let Columns = [
    {
      headerCheckboxSelection: true,
      checkboxSelection: true,
      width: 50,
      showDisabledCheckboxes: false,
      pinned: 'left',
    },
    {
      headerName: '公司',
      field: 'outSouringCompany',
      width: 200,
      tooltipField: 'outSouringCompany',
    },
    {
      headerName: '织布变更单号',
      field: 'planOrderCode',
      width: 200,
      tooltipField: 'planOrderCode',
    },
    {
      headerName: '坯布编号',
      field: 'greyCode',
      width: 200,
    },
    {
      headerName: '坯布名称',
      field: 'greyName',
      tooltipField: 'greyName',
      width: 200,
    },
    {
      headerName: '理论落布转数',
      field: 'rotate',
      width: 200,
    },
    {
      headerName: '变更前指令重量',
      field: 'oldOrderWeight',
      width: 200,
    },
    {
      headerName: '变更前匹数',
      field: 'oldPieceNum',
      width: 200,
    },
    {
      headerName: '变更重量',
      field: 'orderWeight',
      width: 200,
    },
    {
      headerName: '织造交期',
      field: 'weavDeliveryDate',
      width: 200,
    },
    // {
    //   headerName: '单位',
    //   field: 'unit',
    //   width: 200,
    // },
    {
      headerName: '变更日期',
      field: 'planDate',
      width: 200,
    },
    {
      headerName: '创建人',
      field: 'createName',
      width: 200,
    },
    // {
    //   headerName: '订单状态',
    //   field: 'schedulState',
    //   width: 200,
    // },
    {
      headerName: '操作',
      field: 'act',
      width: 200,
      pinned: 'right',
      cellRenderer: {
        template: `
      <a-space><el-button style="color:#165dff;" link @click="a">详情</el-button></a-space>`,
        setup(props: any): any {
          const a = () => {
            handleReturn(props.params.data)
          }
          return {
            a,
          }
        },
      },
    },
  ]
  let Columns1 = [
    {
      headerCheckboxSelection: true,
      checkboxSelection: true,
      width: 50,
      showDisabledCheckboxes: false,
      pinned: 'left',
    },
    {
      headerName: '公司',
      field: 'outSouringCompany',
      width: 200,
      tooltipField: 'outSouringCompany',
    },
    {
      headerName: '织布变更单号',
      field: 'planOrderCode',
      width: 200,
      tooltipField: 'planOrderCode',
    },
    {
      headerName: '坯布编号',
      field: 'greyCode',
      width: 200,
    },
    {
      headerName: '坯布名称',
      field: 'greyName',
      tooltipField: 'greyName',
      width: 200,
    },
    {
      headerName: '理论落布转数',
      field: 'rotate',
      width: 200,
    },
    {
      headerName: '变更前指令重量',
      field: 'oldOrderWeight',
      width: 200,
    },
    {
      headerName: '变更前匹数',
      field: 'oldPieceNum',
      width: 200,
    },
    {
      headerName: '变更重量',
      field: 'orderWeight',
      width: 200,
    },
    {
      headerName: '织造交期',
      field: 'weavDeliveryDate',
      width: 200,
    },
    // {
    //   headerName: '单位',
    //   field: 'unit',
    //   width: 200,
    // },
    {
      headerName: '变更日期',
      field: 'planDate',
      width: 200,
    },
    {
      headerName: '创建人',
      field: 'createName',
      width: 200,
    },
    {
      headerName: '提交日期',
      field: 'updateTime',
      width: 200,
    },
    {
      headerName: '操作',
      field: 'act',
      width: 200,
      pinned: 'right',
      cellRenderer: {
        template: `
      <a-space><el-button style="color:#165dff;" link @click="a">详情</el-button></a-space>`,
        setup(props: any): any {
          const a = () => {
            handleReturn1(props.params.data)
          }
          return {
            a,
          }
        },
      },
    },
    // {
    //   headerName: '订单状态',
    //   field: 'schedulState',
    //   width: 200,
    //   hide: true,
    // },
    // {
    //   headerName: 'id',
    //   field: 'id',
    //   width: 200,
    //   hide: true,
    // }
  ]

  const checked = ref(false)
  const checked2 = ref(false)
  const permissionStore = usePermission()
  const itemsList = ref([
    `${permissionStore.hasPermisson('xzzbd.cx') ? '查询' : ''}`,
    `${permissionStore.hasPermisson('xzzbd.xz') ? '新增' : ''}`,
    '织布通知单',
    '织布通知单(对接订单模版)',
    '完成',
    `${permissionStore.hasPermisson('xzzbd.sc') ? '删除' : ''}`,
    `${permissionStore.hasPermisson('xzzbd.bg') ? '变更' : ''}`,
    `${permissionStore.hasPermisson('xzzbd.tj') ? '提交' : ''}`,
    `${permissionStore.hasPermisson('xzzbd.qxtj') ? '取消提交' : ''}`,
    `${permissionStore.hasPermisson('xzzbd.dc') ? '导出' : ''}`,
    `${permissionStore.hasPermisson('xzzbd.dc') ? '全部导出' : ''}`,
  ])
  const itemsList1 = ref([
    `${permissionStore.hasPermisson('xzzbd.cx') ? '查询' : ''}`,
    `${permissionStore.hasPermisson('xzzbd.tj') ? '提交' : ''}`,
  ])
  const itemsList2 = ref([
    `${permissionStore.hasPermisson('xzzbd.cx') ? '查询' : ''}`,
    '外加工打印',
    '本集团打印',
  ])
  const cascaderRefRef: any = ref()
  const tableColumns = useTableColumn([
    {
      title: '公司名称',
      key: 'outSouringCompany',
      dataIndex: 'outSouringCompany',
      width: 150,
    },
    {
      title: '是否急单',
      key: 'orderNature',
      dataIndex: 'orderNature',
      slotName: 'orderNature',
      width: 150,
    },
    {
      title: '客户',
      key: 'customName',
      dataIndex: 'customName',
      width: 150,
    },
    // {
    //     title: "织造序号",
    //     key: "weaveCode",
    //     dataIndex: "weaveCode",
    //     width: 150
    // },
    {
      title: '织布单号',
      key: 'planOrderCode',
      dataIndex: 'planOrderCode',
      width: 150,
    },
    {
      title: '织造交期',
      key: 'weavDeliveryDate',
      dataIndex: 'weavDeliveryDate',
      width: 150,
    },
    {
      title: '客户订单号',
      key: 'customOrderNo',
      dataIndex: 'customOrderNo',
      width: 150,
    },
    {
      title: '坯布编号',
      key: 'greyCode',
      dataIndex: 'greyCode',
      width: 150,
    },
    {
      title: '坯布名称',
      key: 'greyName',
      dataIndex: 'greyName',
      width: 150,
    },
    {
      title: '坯布批号',
      key: 'greyBatchNo',
      dataIndex: 'greyBatchNo',
      width: 150,
    },
    {
      title: '原料信息',
      key: 'rawInfo',
      dataIndex: 'rawInfo',
      width: 150,
    },
    {
      title: '理论落布转数',
      key: 'rotate',
      dataIndex: 'rotate',
      width: 150,
    },
    {
      title: '指令重量',
      key: 'orderWeight',
      dataIndex: 'orderWeight',
      width: 150,
    },
    {
      title: '匹数',
      key: 'pieceNum',
      dataIndex: 'pieceNum',
      width: 150,
    },
    {
      title: '是否抽针',
      key: 'drawnNeedleState',
      dataIndex: 'drawnNeedleState',
      slotName: 'drawnNeedleState',
      width: 150,
    },
    {
      title: '是否开幅',
      key: 'type', //
      dataIndex: 'type',
      slotName: 'type',
      width: 150,
    },
    // {
    //     title: "业务员",
    //     key: "businessPerson",
    //     dataIndex: "businessPerson",
    //     width: 150
    // },

    {
      title: '开单人',
      key: 'tabulationPerson',
      dataIndex: 'tabulationPerson',
      width: 150,
    },
    {
      title: '开单日期',
      key: 'planDate',
      dataIndex: 'planDate',
      width: 150,
    },
    // {
    //   title: '订单状态',
    //   key: 'schedulState',
    //   dataIndex: 'schedulState',
    //   width: 150,
    // },
    {
      title: '确认状态',
      key: 'auditState',
      dataIndex: 'auditState',
      slotName: 'auditState',
      width: 150,
      fixed: 'right',
    },
    {
      title: '审核人',
      key: 'auditPerson',
      dataIndex: 'auditPerson',
      width: 150,
    },
    {
      title: '审核时间',
      key: 'examineTime',
      dataIndex: 'examineTime',
      width: 150,
    },
    // {
    //   title: '订单完结时间',
    //   key: 'examineTime',
    //   dataIndex: 'examineTime',
    //   width: 150,
    // },
    {
      title: '操作',
      key: 'id',
      dataIndex: 'id',
      slotName: 'action',
      width: 150,
      fixed: 'right',
    },
  ])

  let tc: any[] = tableColumns.map((o) => {
    let obj = {
      headerName: o.title,
      field: o.key,
      pinned: o['fixed'],
    }
    if (o.slotName === 'orderNature') {
      obj['resizable'] = false
      obj['filter'] = false
      obj['sortable'] = false
      obj['lockPosition'] = 'left'
      obj['width'] = 89
      obj['cellRenderer'] = {
        template: `
        <a-checkbox v-model="checked" disabled></a-checkbox>`,
        setup(props: any) {
          let checked = ref()
          checked.value = props.params.data.urgentState == 0 ? false : true
          return {
            checked,
          }
        },
      }
    }
    if (o.slotName === 'drawnNeedleState') {
      obj['resizable'] = false
      obj['filter'] = false
      obj['sortable'] = false
      // obj["lockPosition"] = "right"
      obj['cellRenderer'] = {
        template: `
        <div style="width: 100%;">{{ val }}</div>`,
        setup(props: any) {
          let val = ref()
          val.value = props.params.data.drawnNeedleState == 0 ? '抽针' : '圆筒'
          return {
            val,
          }
        },
      }
    }
    if (o.slotName === 'type') {
      obj['resizable'] = false
      obj['filter'] = false
      obj['sortable'] = false
      // obj["lockPosition"] = "right"
      obj['cellRenderer'] = {
        template: `
        <div style="width: 100%;">{{ val }}</div>`,
        setup(props: any) {
          let val = ref()
          val.value = props.params.data.type == 1 ? '开幅' : '不开幅'
          return {
            val,
          }
        },
      }
    }
    // if (o.slotName === 'schedulState') {
    //   obj['resizable'] = false
    //   obj['filter'] = false
    //   obj['sortable'] = false
    //   obj['width'] = 200
    //   obj['cellRenderer'] = {
    //     template: `
    //           <el-tag class="ml-2" v-if="a == 0" type="warning">待排</el-tag>
    //         <el-tag class="ml-2" v-if="a == 1" type="warning">预排</el-tag>
    //         <el-tag class="ml-2" v-if="a == 2" type="success">已排</el-tag>
    //         <el-tag class="ml-2" v-if="a == 3" type="success">生产完成</el-tag>
    //         <el-tag class="ml-2" v-if="a == 4" type="success">订单完结</el-tag>
    //           `,
    //     setup(props: any) {
    //       return {
    //         a: props.params.data.schedulState,
    //       }
    //     },
    //   }
    // }
    if (o.slotName === 'auditState') {
      obj['resizable'] = false
      obj['filter'] = false
      obj['sortable'] = false
      obj['lockPosition'] = 'right'
      obj['width'] = 100
      obj['cellRenderer'] = {
        template: `
        <el-tag class="ml-2" v-if="a == 0" type="warning">未提交</el-tag>
        <el-tag class="ml-2" v-if="a == 1" type="success">已提交</el-tag>
      `,
        setup(props: any) {
          let val = ref()
          val.value = props.params.data.auditState == 0 ? '未提交' : '已提交'
          return {
            val,
            a: props.params.data.auditState,
          }
        },
      }
    }
    if (o.slotName === 'action') {
      obj['resizable'] = false
      obj['filter'] = false
      obj['sortable'] = false
      obj['lockPosition'] = 'right'
      obj['width'] = 100
      obj['cellRenderer'] = {
        template: `
        <a-space>
          <el-button style="color:#165dff;" link v-if="e1" @click="a1">修改</el-button>
          <el-button type="info" link v-if="e2" @click="a3" disabled>修改</el-button>
          <el-button style="color:#165dff;" link v-if="e2" @click="a2">详情</el-button>
        </a-space>`,
        setup(props: any) {
          const a1 = () => {
            editHandler(props.params.data)
          }
          const a2 = () => {
            xingqingsju(props.params.data)
          }
          const a3 = () => {
            xingqingsju1(props.params.data)
          }
          return {
            e1: props.params.data.auditState == '0',
            e2: props.params.data.auditState == '1',
            a1,
            a2,
            a3,
          }
        },
      }
    }

    return obj
  })

  let a = [
    {
      showRowGroup: 'hide_def',
      headerName: '',
      checkboxSelection: true,
      headerCheckboxSelection: true,
      pinned: 'left',
      width: 50,
      resizable: false,
      filter: false,
      sortable: false,
      minWidth: 50,
      maxWidth: 50,
      lockPosition: 'left',
    },
  ]
  tc.push({
    headerName: '订单状态',
    field: 'schedulState',
    width: 200,
    pinned: 'right',
    cellRenderer: tagRender,
    cellRendererParams: {
      styleClass: (params: any) => {
        return params.schedulState == 0
          ? 'warning'
          : params.schedulState == 1
          ? 'warning'
          : params.schedulState == 2
          ? 'success'
          : params.schedulState == 3
          ? 'success'
          : 'success'
      },
      text: (params: any) => {
        return params.schedulState == 0
          ? '待排产'
          : params.schedulState == 1
          ? '已排产'
          : params.schedulState == 2
          ? '生产中'
          : params.schedulState == 3
          ? '订单完结'
          : params.schedulState == 5
          ? '委外订单'
          : ''
      },
      eltagSize: 0,
    },
    filterParams: {
      valueFormatter: function (params: any) {
        return params.value == 0
          ? '待排产'
          : params.value == 1
          ? '已排产'
          : params.value == 2
          ? '生产中'
          : params.value == 3
          ? '订单完结'
          : params.value == 5
          ? '委外订单'
          : ''
      },
    },
  })
  tc = a.concat(tc)

  let headerShow = ref(true)
  const table = useTable()
  const tables = useTable()
  const tables1 = useTable()
  const tables2 = useTable()
  const pagination = usePagination(doRefresh)
  const paginationA1 = usePagination(getList)
  const pagination1 = usePagination(doRefreshs)
  const formRef = ref<FormInstance>()
  let loadings = ref(false)
  let dataForm: any = reactive({
    orderWeight: 0,
    price: 0,
    amount: 0,
    pieceNum: 0,
    pieceWeight: 0,
    businessDepartmentId: '',
    processType: 0,
    outsideGreigeCode: '',
    machineType: '',
    weavRemark: '',
    schedulState: '',
    makeNum: 0,
    noMakeNum: 0,
    makeWeight: 0,
    noMakeWeight: 0,
    changeWeight: 0,
    orderChangeWeight: 0,
    rotate: 0,
    IsTria: false,
  })
  let dataForm1: any = reactive({
    orderWeight: 0,
    price: 0,
    amount: 0,
    pieceNum: 0,
    pieceWeight: 0,
    businessDepartmentId: '',
    processType: 0,
    outsideGreigeCode: '',
    machineType: '',
    weavRemark: '',
    schedulState: '',
    makeNum: 0,
    noMakeNum: 0,
    makeWeight: 0,
    noMakeWeight: 0,
    changeWeight: 0,
    orderChangeWeight: 0,
    rotate: 0,
  })

  let gsDatas = ref<any[]>([])
  onMounted(() => {
    updateGridState01()
    updateGridState02()
    updateGridState03()
    updateGridState04()
    doRefresh()
    pageData.rHeight = document.getElementsByClassName('arco-tabs-content')[0]?.clientHeight
    //弹出层的高
    if (pageData.rHeight !== undefined) {
      pageData.rHeight = pageData.rHeight - 100
    }
    window.addEventListener('resize', () => {
      pageData.rHeight = document.getElementsByClassName('arco-tabs-content')[0]?.clientHeight
      //弹出层的高
      if (pageData.rHeight !== undefined) {
        pageData.rHeight = pageData.rHeight - 100
      }
    })
    // post({
    //     url: 'org/firmGroup/getFirmInfoByMap'
    // }).then(res => {
    //     if (res.code == 200) {
    //         gsDatas.value = res.data
    //     }
    // })
  })
  const scrollbar = ref(true)
  const total = ref(0)
  const page = ref(1)
  const size = ref(10)

  function PageSize(val: any) {
    if (active.value == 0) {
      paginationA1.page = val
      getList()
    } else if (active.value == 1) {
      paginationA1.page = val
      getList()
    } else if (active.value == 2) {
      pagination.page = val
      doRefresh()
    }
  }

  function change1(val: any) {
    if (active.value == 0) {
      paginationA1.pageSize = val
      getList()
    } else if (active.value == 1) {
      paginationA1.pageSize = val
      getList()
    } else if (active.value == 2) {
      pagination.pageSize = val
      doRefresh()
    }
  }

  function doRefresh() {
    pageData.pageLoading = true
    post({
      url: 'planSingle/planOrder/getPageInfo',
      data: {
        page: pagination.page,
        size: pagination.pageSize,
        deleteState: 0,
        weaveCode: pageData.zxXh,
        planOrderCode: pageData.jhXh,
        customOrderNo: pageData.pbXh,
        customName: pageData.bmXh,
        businessPerson: pageData.ywy,
        auditState: pageData.shZt,
        orderType: 0,
      },
    })
      .then(({ data, code }: any) => {
        if (code === 200) {
          loadings.value = false
          table.handleSuccess(data.list)
          // pagination.setTotalSize(data.total);
          gridOption.value.setRowData(data.list)
          total.value = data.total
        }
      })
      .catch(console.log)
      .finally(() => {
        pageData.pageLoading = false
      })
  }

  function doRefreshs(id?: any) {
    pageData.pageLoading = true

    post({
      url: 'planSingle/planOrder/getVersionPage',
      data: {
        page: pagination1.page,
        size: pagination1.pageSize,
        planOrderId: id,
      },
    })
      .then(({ data, code }: any) => {
        if (code === 200) {
          tables2.handleSuccess(data.list)
          // pagination1.setTotalSize(data.total);
          gridOption.value.setRowData(data.list)
          total.value = data.total
        }
      })
      .catch(console.log)
      .finally(() => {
        pageData.pageLoading = false
      })
  }

  const pibuArray = reactive({
    pibu1: '',
    pibu2: '',
  })

  const jiTypes = ref()

  const editHandler = (val: any) => {
    // get({
    //     url: '/org/firmGroup/getTreeFirmGroup',
    // }).then(({ code, data }) => {
    //     if (code === 200) {
    //         firmLists.value = data
    //     }
    // })
    // post({
    //     url: 'org/firmGroup/getFirmInfoByMap'
    // }).then(res => {
    //     if (res.code == 200) {
    //         gsDatas.value = res.data
    //     }
    // })
    // dataForm.widthState = val.scutchingState === 0 ? '开幅' : '不开幅'
    loadings.value = true
    pibuArray.pibu1 = val.greyBatchNo.split('-')[0]
    pibuArray.pibu2 = val.greyBatchNo.split('-')[1]
    post({
      url: 'planSingle/planOrder/getRawmaterialInfo',
      data: val.id,
    }).then(async (res: any) => {
      if (res.code == 200) {
        datasList.value = res.data
        await renderTableDateList(datasList.value)
        tableDateList.value.forEach((e: any) => {
          e['yarnUnits'] = e['yarnUnit']
        })
      } else {
        Message.error('获取原料信息失败')
      }
    })
    post({
      url: 'planSingle/planOrderChange/getLikeList',
      data: { planOrderCode: val.planOrderCode },
    }).then((res: any) => {
      if (res.code == 200) {
        tableDateList2_1.value = res.data
      } else {
        Message.error(res.message)
      }
    })
    post({
      url: 'product/pdGreyInformation/selectpdGreyInformation',
      data: {
        grayFabricName: val.greyName,
      },
    }).then((res: any) => {
      if (res.code == 200) {
        // dataForm.widthState = Number(res.data[0].scutchingState)
        dataForm.widthState = Number(val.type)
        dataForm.weavRemark = res.data[0].weavingNote
        isDatasList.value = res.data
        jiTypes.value = res.data[0].machineType
        let idsDta
        let organizationPinId
        let arrangementId
        let cutMouthNeedleId
        isDatasList.value.forEach((res: any) => {
          if (res.greyCode == val.greyCode) {
            idsDta = res.id
            organizationPinId = res.organizationPinId
            arrangementId = res.arrangementId
            cutMouthNeedleId = res.cutMouthNeedleId
            dataForm.machineType = res.machineType
            dataForm.greyId = res.id
            post({
              url: 'product/pdGreyInformation/select',
              data: {
                id: idsDta,
              },
            }).then(({ code, data }) => {
              if (code === 200) {
                dataForm.productColthCode = data.greyInformation.popularizeCommodity
                dataForm.weavRemark = data.greyInformation.weavingNote
                // 组织排针 数据
                zzpzdata.value =
                  data.organizationPinSons.length == 0
                    ? [
                        {
                          upBasin: '',
                          belowBasin: '',
                          id: '',
                          pdOrganizationPinId: '',
                        },
                      ]
                    : data.organizationPinSons
                // 裁口排针
                if (data.cuttingMouthNeedleGrey != null) {
                  let cuttingMouthNeedleGrey = data.cuttingMouthNeedleGrey
                  ckpzobj.id = cuttingMouthNeedleGrey.id
                  ckpzobj.pinHeader = cuttingMouthNeedleGrey.pinHeader
                  ckpzobj.arrangement = cuttingMouthNeedleGrey.arrangement
                }
                //tw加
                if (data.cuttingMouthNeedleGrey != null && data.cuttingMouthNeedleGrey.length > 0) {
                  ckpzobj.pinHeader = data.cuttingMouthNeedleGrey[0].pinHeader
                  ckpzobj.arrangement = data.cuttingMouthNeedleGrey[0].arrangement
                  // ckpzid.value = data.cuttingMouthNeedleGrey[0].cmdName
                }
                // 排三角arrangementTriangleGreys
                sjdata.sj = data.arrangementTriangleGreys.info
                // sjdata.sjid=data.arrangementTriangleGreys.greyId
                // psjpb.value=data.arrangementTriangleGreys.greyId 现有坯布
                sjdata.atCode = data.arrangementTriangleGreys.atCode
                sjdata.atName = data.arrangementTriangleGreys.atName
                sjdata.remark = data.arrangementTriangleGreys.remark
                psList.value = data.atOther
              } else {
                Message.error('获取原料失败')
              }
            })
          }
        })
      } else {
        Message.error('获取失败')
      }
    })
    doRefreshs(val.id)
    setTimeout(() => {
      cascaderRef2.value?.parentComponent({
        corporateId: val.verifyClothCompanyId,
      })
      for (let item in val) {
        dataForm[item] = val[item]
        if (item == 'computeMode') {
          dataForm.computeMode = val['computeMode'] == 0 ? '条距' : '路数'
        }
      }
      dataForm.widthState = Number(val.type)
      checked.value = dataForm['urgentState'] == 0 ? false : true
      checked2.value = dataForm['tryYarnState'] == 0 ? false : true
      dataForm.IsTria = !dataForm['IsTria'] || dataForm['IsTria'] == 0 ? false : true
      loadings.value = false
      pageData.showAdd = true
      nextTick(() => {
        cc(val)
      })
      pageData.sideTitle = '修改织布单'
    }, 100)
  }

  const cc = (val: any) => {
    for (var key in val) {
      dataForm[key] = val[key]
    }
    let data = {
      corporateId: val.outSouringCompanyId,
      corporateLabel: val.outSouringCompany,
    }
    let data2 = {
      corporateId: val.verifyClothCompanyId,
      corporateLabel: val.verifyClothCompany,
    }
    cascaderRefRef.value?.parentComponent(data)
    cascaderRef2.value?.parentComponent(data2)
  }

  const deleteHandler = () => {
    if (gridOption.value.getSelectedRows().length === 0) {
      Message.error('请先勾选')
      return
    }
    Modal.confirm({
      title: '系统提示',
      content: '确认删除选中的数据?',
      onOk() {
        post({
          url: 'planSingle/planOrder/delete',
          // data: selectedRowKeys.value,
          data: gridOption.value.getSelectedRows().map((o: any) => {
            return o.id
          }),
        }).then(({ code, data, message }: any) => {
          if (code === 200) {
            Message.success({
              content: '删除成功',
              duration: 5000,
            })
            selectedRowKeys.value = []
            pagination.page = 1
            doRefresh()
          } else {
            Message.error({
              content: message,
              duration: 5000,
            })
          }
        })
      },
    })
  }

  const selectHandler = () => {
    loadings.value = true
    pagination.page = 1
    doRefresh()
  }

  let pageData: any = reactive({
    rHeight: 500,
    pageLoading: false,
    showAdd: false,
    showAdd1: false,
    sideTitle: '',
    zxXh: '',
    zxArray: [],
    jhXh: '',
    jhArray: [],
    pbXh: '',
    pbArray: [],
    bmXh: '',
    bmArray: [],
    ywy: '',
    ywyArray: [],
    addWeightLoading: false,
    outSouringCompanyId: null,
    drawerLoading: false,
  })
  const zxXhCx = (isObj: any, isArray: any) => {
    post({
      url: 'planSingle/planOrder/getDropInfo',
      data: isObj,
    }).then((res: any) => {
      if (res.code == 200) {
        if (isArray == 'zx') {
          pageData.zxArray = res.data
        }
        if (isArray == 'jh') {
          pageData.jhArray = res.data
        }
        if (isArray == 'pbmc') {
          pageData.pbArray = res.data
        }
        if (isArray == 'pbbh') {
          pageData.bmArray = res.data
        }
        if (isArray == 'ywy') {
          pageData.ywyArray = res.data
        }
      }
    })
  }
  const searchs = (val: any) => {
    zxXhCx({ businessPerson: val }, 'ywy')
  }
  const searchsz = (val: any) => {
    zxXhCx({ customName: val }, 'pbbh')
  }
  const searchsa = (val: any) => {
    zxXhCx({ customOrderNo: val }, 'pbmc')
  }
  const searchsx = (val: any) => {
    zxXhCx({ planOrderCode: val }, 'jh')
  }
  const searchso = (val: any) => {
    zxXhCx({ weaveCode: val }, 'zx')
  }
  let selectedRowKeys = ref([])
  let selectedRowKeys1 = ref([])
  const machineCodeXZ = ref('')
  const dblclicksShowA2 = ref(false)
  const tcA2DataList: any = ref([])
  const gridOptionA2 = ref()
  const gridReadyA2 = (params: any) => {
    gridOptionA2.value = params.api
  }
  const dblclicksShowA3 = ref(false)
  const dblclicksShowA4 = ref(false)
  const dblclicksText = ref([])
  const dblclicksData = ref('')
  const tcA3DataList: any = ref([])
  const gridOptionA3 = ref()
  const gridReadyA3 = (params: any) => {
    gridOptionA3.value = params.api
  }
  // 表格准备事件

  const tableDateList: any = ref([])
  const tableDateList_1: any = ref([])
  const tableDateList2_1: any = ref([])

  const sideOk = () => {
    tableDateList.value.forEach((e: any) => {
      e['yarnUnit'] = e['yarnUnits']
    })
    user()
    formRef.value?.validate().then((err) => {
      user()
      if (!err) {
        loadings.value = true
        addLoding.value = true
        if (pageData.sideTitle == '新增织布单') {
          dataForm['urgentState'] = checked.value ? 1 : 0
          dataForm['tryYarnState'] = checked2.value ? 1 : 0
          dataForm['IsTria'] = dataForm.IsTria ? 1 : 0
          // dataForm['type'] = dataForm.widthState+''
          post({
            url: 'planSingle/planOrder/add',
            data: {
              ...dataForm,
              planOrderRawmaterial: tableDateList.value,
              greyUnitName: unit.value,
            },
          })
            .then((res: any) => {
              if (res.code == 200) {
                user()
                addLoding.value = false
                Message.success('新增成功')
                doRefresh()
                loadings.value = false
                pageData.showAdd = false
                formRef.value?.resetFields()
                pibuArray.pibu1 = ''
                pibuArray.pibu2 = ''
              } else {
                Message.error(res.message)
                addLoding.value = false
                loadings.value = false
              }
            })
            .finally(() => {
              loadings.value = false
            })
        } else if (pageData.sideTitle == '修改织布单') {
          dataForm['urgentState'] = checked.value ? 1 : 0
          dataForm['tryYarnState'] = checked2.value ? 1 : 0
          dataForm['IsTria'] = dataForm.IsTria ? 1 : 0
          dataForm['type'] = dataForm.widthState + ''
          post({
            url: 'planSingle/planOrder/update',
            data: {
              ...dataForm,
              planOrderRawmaterial: tableDateList.value,
              greyUnitName: unit.value,
            },
          })
            .then((res: any) => {
              if (res.code == 200) {
                Message.success('修改成功')
                doRefresh()
                addLoding.value = false

                pageData.showAdd = false
                pageData.showAdd1 = false
                formRef.value?.resetFields()
                pibuArray.pibu1 = ''
                pibuArray.pibu2 = ''
              } else {
                Message.error(res.message)
                addLoding.value = false
                loadings.value = false
              }
            })
            .finally(() => {
              addLoding.value = false
            })
        }
      }
    })
  }

  const sideAddLoading = ref(false)

  const sideOks = () => {
    tableDateList.value.forEach((e: any) => {
      e['yarnUnit'] = e['yarnUnits']
    })
    user()
    formRef.value?.validate().then((err) => {
      user()
      if (!err) {
        loadings.value = true
        sideAddLoading.value = true
        dataForm1['urgentState'] = checked.value ? 1 : 0
        dataForm1['tryYarnState'] = checked2.value ? 1 : 0
        // dataForm1['type'] = dataForm1.widthState+''
        post({
          url: 'planSingle/planOrderChange/saveChangeInfo',
          data: {
            ...dataForm1,
            rawInfo: tableDateList_1.value,
          },
        })
          .then((res: any) => {
            if (res.code == 200) {
              user()
              Message.success('保存成功')
              doRefresh()
              ChangeButtonVisible.value = false
              loadings.value = false
              pageData.showAdd = false
              formRef.value?.resetFields()
              pibuArray.pibu1 = ''
              pibuArray.pibu2 = ''
              sideAddLoading.value = false
            } else {
              Message.error(res.message)
              sideAddLoading.value = false
              loadings.value = false
            }
          })
          .finally(() => {
            sideAddLoading.value = false
            loadings.value = false
          })
      }
    })
  }

  const ChangeButtonVisible1 = () => {
    ChangeButtonVisible.value = false
    for (let item in dataForm1) {
      dataForm1[item] = ''
    }
    // tableDateList_1.value = []
    doRefresh()
  }
  let ysDataList = ref<any[]>([])
  let dwDataList = ref<any[]>([])
  let blDataList = ref<any[]>([])
  let ztDataList = ref<any[]>([])
  const addHandler = async () => {
    loadings.value = true
    let res = await post({
      url: 'planSingle/planOrder/getAutomaticInfo',
    })
    if (dataForm.processType == 0) {
      dataForm.processType = '本集团'
    } else {
      dataForm.processType = '外加工'
    }
    if (res.code == 200) {
      zzpzdata.value = []
      sjdata.sj = []
      tables.handleSuccess([])
      tableDateList.value = []
      for (let item in dataForm) {
        dataForm[item] = ''
      }
      dataForm.tabulationPerson = res.data.tabulationPerson
      dataForm.weaveCode = res.data.weaveCode
      dataForm.planOrderCode = res.data.planOrderCode
      dataForm.weavClothCode = res.data.planOrderCode
      dataForm.planDate = res.data.planDate
      dataForm.IsTria = false
      dataForm.productMode = '织造'
      dataForm.shrinkageControl = '横: < %5 直: <%5'
      loadings.value = false
      pageData.showAdd = true
      setTimeout(() => {
        gridOption3.value.setRowData([])
        user()
      }, 100)
      pageData.sideTitle = '新增织布单'
      dataForm.pieceWeight = 25
    }
  }
  const isTy = (val: any) => {
    dataForm.pieceNum = Math.ceil(dataForm.orderWeight / val)
    getRotate()
  }
  const isPs = (val: any) => {
    dataForm.orderWeight = dataForm.pieceWeight * val
  }

  const isDj = (val: any) => {
    dataForm.amount = dataForm.orderWeight * val
  }
  const isDj1 = (val: any) => {
    dataForm1.amount = dataForm1.orderChangeWeight * dataForm1.price
  }
  const hqColor = (val: any) => {
    post({
      url: 'product/color/getFieldValue',
      data: {
        colorName: val,
      },
    }).then((res: any) => {
      if (res.code == 200) {
        ysDataList.value = res.data
      }
    })
  }
  const disabledDate = (currentDate: any) => {
    // 禁用当前日期之前的日期
    return currentDate && currentDate < new Date()
  }
  const hqZt = () => {
    post({
      url: 'product/workdrumEquipment/selectWorkdrumEquipment',
      data: {
        deleteState: 0,
      },
    }).then((res: any) => {
      if (res.code == 200) {
        ztDataList.value = res.data
      }
    })
  }
  const hqDw = () => {
    post({
      url: 'product/productUnit/getList',
      data: {
        deleteState: 0,
      },
    }).then((res: any) => {
      if (res.code == 200) {
        dwDataList.value = res.data
      }
    })
  }
  const shenghe = () => {
    if (gridOption.value.getSelectedRows().length === 0) {
      Message.error('请先勾选')
      return
    }
    if (gridOption.value.getSelectedRows().length > 1) {
      Message.error('只能勾选一条')
      return
    }
    let isTanc = true
    table.dataList.forEach((iten: any) => {
      if (gridOption.value.getSelectedRows()[0]['id'] == iten.id) {
        if (iten.auditState == 1) {
          Message.warning('订单已提交')
          isTanc = false
        } else {
          isTanc = true
        }
      }
    })
    if (isTanc) {
      Modal.confirm({
        title: '系统提示',
        content: '确认勾选的计划单是否提交?',
        onOk() {
          pageData.pageLoading = true
          post({
            url: 'planSingle/planOrder/audit',
            data: [
              {
                id: Number(gridOption.value.getSelectedRows()[0]['id']),
                auditState: Number(1),
                // data: gridOption.value.getSelectedRows().map((o:any)=>{return o.Number(1)})
              },
            ],
          })
            .then((res: any) => {
              if (res.code === 200) {
                doRefresh()
                Message.success('提交成功')
                // gridOption.value.getSelectedRows = []
              } else {
                Message.error(res.message)
              }
            })
            .catch(console.log)
            .finally(() => {
              pageData.pageLoading = false
            })
        },
      })
    }
  }
  const fShen = () => {
    if (gridOption.value.getSelectedRows().length === 0) {
      Message.error('请先勾选')
      return
    }
    if (gridOption.value.getSelectedRows().length > 1) {
      Message.error('请先勾选一条')
      return
    }
    let isTanc = true
    table.dataList.forEach((iten: any) => {
      if (gridOption.value.getSelectedRows()[0]['id'] == iten.id) {
        if (iten.auditState == 0) {
          Message.warning('订单未提交')
          isTanc = false
        } else {
          isTanc = true
        }
      }
    })
    if (isTanc) {
      Modal.confirm({
        title: '系统提示',
        content: '确认勾选的计划单是否取消提交',
        onOk() {
          pageData.pageLoading = true
          post({
            url: 'planSingle/planOrder/audit',
            data: [
              {
                id: Number(gridOption.value.getSelectedRows()[0]['id']),
                auditState: Number(0),
              },
            ],
          })
            .then((res: any) => {
              if (res.code === 200) {
                doRefresh()
                Message.success('取消提交成功')
                // gridOption.value.getSelectedRows = []
              } else {
                Message.error(res.message)
              }
            })
            .catch(console.log)
            .finally(() => {
              pageData.pageLoading = false
            })
        },
      })
    }
  }

  const ckList = () => {}
  const lxList = ref<any[]>([])
  const lxSelect = () => {
    post({
      url: 'planSingle/scutchingType/getFieldValue',
      data: {
        typeName: '',
      },
    }).then(({ code, data }) => {
      if (code === 200) {
        lxList.value = data
      }
    })
  }
  const exportsz = () => {
    if (gridOption.value.getSelectedRows().length === 0) {
      Message.error('请先勾选')
      return
    } else {
      let idList: any = []
      gridOption.value.getSelectedRows().forEach(function (o: any) {
        idList.push(o['id'])
      })

      //将表头拼接出来
      let head =
        '<th>是否急单</th><th>客户</th><th>织布单号</th><th>客户订单号</th><th>坯布编号</th><th>坯布名称</th><th>坯布批号</th><th>指令重量</th><th>匹数</th><th>抽针</th><th>是否开幅</th><th>开单人</th><th>开单日期</th><th>确认状态</th><th>审核人</th>'
      //拿到当前表格数据与勾选的行做筛选

      let nowRow = table.dataList.filter(function (os: any) {
        return (
          gridOption.value
            .getSelectedRows()
            .map((o: any) => {
              return o.id
            })
            .indexOf(os['id']) !== -1
        )
      })
      let body = ''
      nowRow.forEach(function (o) {
        body +=
          '<tr><td>' +
          (o['urgentState'] == undefined ? '' : o['urgentState'] == 0 ? '否' : '是') +
          '</td>'
        body += '<td>' + (o['customName'] == undefined ? '' : o['customName']) + '</td>'
        // body += "<td>" + (o["weaveCode"] == undefined ? "" : o["weaveCode"]) + "</td>";
        body += '<td>' + (o['planOrderCode'] == undefined ? '' : o['planOrderCode']) + '</td>'
        body += '<td>' + (o['customOrderNo'] == undefined ? '' : o['customOrderNo']) + '</td>'
        body += '<td>' + (o['greyCode'] == undefined ? '' : o['greyCode']) + '</td>'
        body += '<td>' + (o['greyName'] == undefined ? '' : o['greyName']) + '</td>'
        body += '<td>' + (o['greyBatchNo'] == undefined ? '' : o['greyBatchNo']) + '</td>'
        body += '<td>' + (o['orderWeight'] == undefined ? '' : o['orderWeight']) + '</td>'
        body += '<td>' + (o['pieceNum'] == undefined ? '' : o['pieceNum']) + '</td>'
        body += '<td>' + (o['drawnNeedleState'] === 0 ? '抽针' : '圆筒') + '</td>'
        body += '<td>' + (o['type'] == 1 ? '开幅' : '不开幅') + '</td>'
        // body += "<td>" + (o["businessPerson"] == undefined ? "" : o["businessPerson"]) + "</td>";
        body += '<td>' + (o['tabulationPerson'] == undefined ? '' : o['tabulationPerson']) + '</td>'
        body += '<td>' + (o['planDate'] == undefined ? '' : o['planDate']) + '</td>'
        body += '<td>' + (o['auditState'] === 0 ? '未提交' : '已提交') + '</td>'
        body += '<td>' + (o['auditPerson'] == undefined ? '' : o['auditPerson']) + '</td>'
        body += '</tr>'
      })
      tableToXlsx(head, '计划单', body)
      // console.log(table)
    }
  }

  function tableToXlsx(head: any, filename: any, body: any) {
    const uri = 'data:application/vnd.ms-excel;base64,',
      template = `<html>
            <head><meta charset="UTF-8"></head>
            <body><table border="1"><tr>${head}</tr>${body}</table></body>
        </html>`

    const a = document.createElement('a')
    a.href = uri + window.btoa(decodeURIComponent(encodeURIComponent(template)))
    a.download = filename
    a.click()
    document.removeChild(a)
  }

  //下拉框得到焦点
  const focusSel = () => {
    selCxAll({ grayFabricName: '', deleteState: 0, auditState: 1 })
  }
  //下拉数据
  const options = ref<any>(pageData.clothList)
  const loading = ref(false)
  const handleSearch = (value: any) => {
    if (value) {
      const ob = { grayFabricName: value, deleteState: 0, auditState: 1 }
      loading.value = true
      selCxAll(ob)
      options.value = pageData.clothList
      loading.value = false
    } else {
      options.value = []
    }
  }

  //下拉框查询
  function selCxAll(val: any) {
    post({
      url: 'product/pdGreyInformation/getFieldValue',
      data: val,
    }).then(({ data, code }: any) => {
      if (code === 200) {
        pageData.clothList = data
      } else {
        Message.error({
          content: '查询失败！',
          duration: 5000,
        })
      }
    })
  }

  //下拉框得到焦点
  const focusSelr = () => {
    selCxAllr({ typeName: '', deleteState: 0 })
  }
  //下拉数据
  const optionsr = ref<any>(pageData.clothListr)
  const loadingr = ref(false)
  const handleSearchr = (value: any) => {
    if (value) {
      const ob = { typeName: value, deleteState: 0 }
      loadingr.value = true
      selCxAllr(ob)
      options.value = pageData.clothListr
      loadingr.value = false
    } else {
      optionsr.value = []
    }
  }

  //下拉框查询
  function selCxAllr(val: any) {
    post({
      url: 'product/yarnType/getFieldValue',
      data: val,
    }).then(({ data, code }: any) => {
      if (code === 200) {
        // console.log(data)
        // (data as string[]).splice(0, 0, "全部");
        pageData.clothListr = data
      } else {
        Message.error({
          content: '查询失败！',
          duration: 5000,
        })
      }
    })
  }

  let isDatasList = ref<any[]>([])
  let unit = ref()
  const ckpzobj = reactive({
    id: 0,
    pinHeader: '',
    arrangement: '',
  })

  //排纱
  let psList = ref<any[]>([])
  const numb = reactive<{ row: number[]; col: number }>({
    row: [1, 1],
    col: 1,
  })
  let datasList: any = ref<any[]>([])

  const isDatasListMap: any = ref([])

  const changes1 = (val: any) => {
    post({
      url: 'product/pdGreyInformation/getFieldValue',
      data: {
        greyCode: val,
        auditState: 1,
      },
    }).then((res: any) => {
      if (res.code == 200) {
        isDatasListMap.value = res.data
      }
    })
  }
  //根据坯布编号获取弹窗下表格的数据
  const renderTableDateList = async (data: any) => {
    data.forEach((o: any) => {
      o.firmld = dataForm.outSouringCompanyId
      o.warehouseTypeName = '原纱'
    })
    const res = await post({
      url: 'planSingle/planOrder/getWmsNumInfo',
      data: data,
    })
    try {
      if (res.code == 200) {
        tableDateList.value = res.data
      } else {
        Message.error(res.message)
      }
    } catch (e) {
      console.log(e)
    }
  }
  const changes11 = (val: any) => {
    if (val == '') {
      dataForm.greyName = ''
      dataForm.workDrum = ''
      dataForm.weavRemark = ''
      dataForm.drawnNeedleState = ''
      dataForm.widthState = ''
      // tables.handleSuccess([])
      // gridOption3.value.setRowData([])
      tableDateList.value = []
    } else {
      post({
        url: 'product/pdGreyInformation/selectpdGreyInformation',
        data: {
          greyCode: val,
        },
      }).then((res: any) => {
        if (res.code == 200) {
          dataForm.widthState = Number(res.data[0].scutchingState)
          dataForm.weavRemark = res.data[0].weavingNote
          dataForm.greyName = res.data[0].grayFabricName
          jiTypes.value = res.data[0].machineType
          post({
            url: 'product/Contrast/getList',
            data: {
              greigeCode: val,
              greigeName: res.data[0].grayFabricName,
              deleteState: 0,
              obsoleteState: 0,
            },
          }).then((a: any) => {
            if (a.code == 200) {
              if (a.data.length != 0) {
                dataForm.outsideGreigeCode = a.data[0].outsideGreigeCode
              }
            }
          })
          // changes(dataForm.greyName)
          isDatasList.value = res.data
          dataForm.price = res.data[0].machineUnit
          jiTypes.value = res.data[0].machineType
          dataForm.amount = dataForm.price * dataForm.orderWeight
          let idsDta
          let organizationPinId
          let arrangementId
          let cutMouthNeedleId
          isDatasList.value.forEach((res: any) => {
            if (res.greyCode == val) {
              idsDta = res.id
              organizationPinId = res.organizationPinId
              arrangementId = res.arrangementId
              cutMouthNeedleId = res.cutMouthNeedleId
              unit.value = res.unit
              dataForm.greyId = res.id
              dataForm.greyCode = res.greyCode
              dataForm.machineType = res.machineType
              let workDrumString =
                res.dimensionFigure +
                '“' +
                res.needleCount +
                'G*' +
                res.sumNeedleCount +
                '*' +
                res.alwaysGoes

              // if (dataForm.processType == 1 && !workDrumString.endsWith('F')) {
              //   workDrumString += 'F'; // 使用 += 来追加字符串
              // }

              dataForm.workDrum = workDrumString
              dataForm.drawnNeedleState = res.drawnNeedleState
              dataForm.widthState = Number(res.scutchingState)
              dataForm.width = res.finishedLimit
              dataForm.weight = res.finishedWeight

              post({
                url: 'product/pdGreyInformation/select',
                data: {
                  id: idsDta,
                },
              }).then(async ({ code, data }) => {
                if (code === 200) {
                  dataForm.weavRemark = data.greyInformation.weavingNote
                  dataForm.productColthCode = data.greyInformation.popularizeCommodity
                  datasList.value = []
                  for (let i = 0; i < data.yarnStructures.length; i++) {
                    datasList.value.push({
                      // colourNumber色号
                      // colorAccording色称
                      rawmaterialCode: data.yarnStructures[i].yarnCode
                        ? data.yarnStructures[i].yarnCode
                        : '',
                      rawmaterialName: data.yarnStructures[i].staple
                        ? data.yarnStructures[i].staple
                        : '',
                      yarnProportion: data.yarnStructures[i].yarnCountProportion
                        ? data.yarnStructures[i].yarnCountProportion
                        : '',
                      weaveLoss: data.yarnStructures[i].weavingDamage
                        ? data.yarnStructures[i].weavingDamage
                        : '',
                      colorCode: data.yarnStructures[i].colourNumber
                        ? data.yarnStructures[i].colourNumber
                        : '',
                      colorName: data.yarnStructures[i].colorAccording
                        ? data.yarnStructures[i].colorAccording
                        : '',
                      grade: data.yarnStructures[i].grade ? data.yarnStructures[i].grade : '',
                      yarnSource: data.yarnStructures[i].yarnSource
                        ? data.yarnStructures[i].yarnSource
                        : '',
                      yarnLength: data.yarnStructures[i].yarnLong
                        ? data.yarnStructures[i].yarnLong
                        : '',
                      yarnUnits: data.yarnStructures[i].yarnUnits
                        ? data.yarnStructures[i].yarnUnits
                        : '',
                    })
                  }
                  await renderTableDateList(datasList.value)
                  tableDateList.value.forEach(async (cc: any, i: any) => {
                    let temp = await blurOrderWeight(cc, 1)
                    setTimeout(() => {
                      post({
                        url: 'planSingle/planOrder/getRawNumInfo',
                        data: {
                          rawmaterialName: tableDateList.value[i]
                            ? tableDateList.value[i].rawmaterialName
                            : '', //原料名称
                          rawmaterialCode: tableDateList.value[i]
                            ? tableDateList.value[i].rawmaterialCode
                            : '', //原料编号
                          withYarnNum: tableDateList.value[i].withYarnNum,
                          //配纱数量
                        },
                      }).then((Infores: any) => {
                        if (Infores.code == 200) {
                          cc.outboundNum = Infores.data.outboundNum
                          cc.backYarnNum = Infores.data.backYarnNum
                          cc.oweNum = Infores.data.ownNum
                        }
                      })
                    }, 1000)
                  })
                  gridOption3.value.setRowData(tableDateList.value)
                  // 组织排针 数据
                  zzpzdata.value =
                    data.organizationPinSons.length == 0
                      ? [
                          {
                            upBasin: '',
                            belowBasin: '',
                            id: '',
                            pdOrganizationPinId: '',
                          },
                        ]
                      : data.organizationPinSons
                  // 裁口排针
                  if (data.cuttingMouthNeedleGrey != null) {
                    let cuttingMouthNeedleGrey = data.cuttingMouthNeedleGrey
                    ckpzobj.id = cuttingMouthNeedleGrey.id
                    ckpzobj.pinHeader = cuttingMouthNeedleGrey.pinHeader
                    ckpzobj.arrangement = cuttingMouthNeedleGrey.arrangement
                  }
                  //tw加
                  if (
                    data.cuttingMouthNeedleGrey != null &&
                    data.cuttingMouthNeedleGrey.length > 0
                  ) {
                    ckpzobj.pinHeader = data.cuttingMouthNeedleGrey[0].pinHeader
                    ckpzobj.arrangement = data.cuttingMouthNeedleGrey[0].arrangement
                    // ckpzid.value = data.cuttingMouthNeedleGrey[0].cmdName
                  }
                  // 排三角arrangementTriangleGreys
                  sjdata.sj = data.arrangementTriangleGreys.info
                  // sjdata.sjid=data.arrangementTriangleGreys.greyId
                  // psjpb.value=data.arrangementTriangleGreys.greyId 现有坯布
                  sjdata.atCode = data.arrangementTriangleGreys.atCode
                  sjdata.atName = data.arrangementTriangleGreys.atName
                  sjdata.remark = data.arrangementTriangleGreys.remark
                  psList.value = data.atOther
                } else {
                  Message.error('获取原料失败')
                }
              })
            }
          })
        } else {
          Message.error('获取失败')
        }
      })
      getRotate()
    }
  }

  //获取理论转数
  const getRotate = () => {
    let code = ''
    let weight = null
    if (pageData.sideTitle == '织布单变更') {
      code = dataForm1.greyCode
      weight = dataForm1.pieceWeight
    } else {
      code = dataForm.greyCode
      weight = dataForm.pieceWeight
    }
    if (code && weight) {
      post({
        url: 'planSingle/planOrder/getRotate',
        data: {
          greyCode: code,
          pieceWeight: weight,
        },
      }).then((res: any) => {
        if (res.code == 200) {
          if (pageData.sideTitle == '织布单变更') {
            dataForm1.rotate = res.data.rotate
          } else {
            dataForm.rotate = res.data.rotate
          }
        } else {
          Message.error(res.message)
        }
      })
    }
  }

  const changes = (val: any) => {
    if (val == '') {
      dataForm.greyCode = ''
      dataForm.workDrum = ''
      // tables.handleSuccess([])
      // gridOption3.value.setRowData([])
      tableDateList.value = []
    } else {
      dataForm.greyCode = ''
      datasList.value = []
      // tables.handleSuccess([])
      // gridOption3.value.setRowData([])
      tableDateList.value = []
      post({
        url: 'product/pdGreyInformation/selectpdGreyInformation',
        data: {
          grayFabricName: val,
        },
      }).then((res: any) => {
        if (res.code == 200) {
          dataForm.widthState = Number(res.data[0].scutchingState)
          dataForm.weavRemark = res.data[0].weavingNote
          isDatasList.value = res.data
          dataForm.price = res.data[0].machineUnit
          jiTypes.value = res.data[0].machineType
          dataForm.amount = dataForm.price * dataForm.orderWeight
          let idsDta
          let organizationPinId
          let arrangementId
          let cutMouthNeedleId
          isDatasList.value.forEach((res: any) => {
            if (res.grayFabricName == val) {
              idsDta = res.id
              organizationPinId = res.organizationPinId
              arrangementId = res.arrangementId
              cutMouthNeedleId = res.cutMouthNeedleId
              unit.value = res.unit
              dataForm.greyId = res.id
              dataForm.greyCode = res.greyCode
              dataForm.machineType = res.machineType
              dataForm.workDrum =
                res.dimensionFigure +
                '“' +
                res.needleCount +
                'G*' +
                res.sumNeedleCount +
                '*' +
                res.alwaysGoes
              dataForm.drawnNeedleState = res.drawnNeedleState
              dataForm.widthState = Number(res.scutchingState)
              dataForm.width = res.finishedLimit
              dataForm.weight = res.finishedWeight

              post({
                url: 'product/pdGreyInformation/select',
                data: {
                  id: idsDta,
                },
              }).then(({ code, data }) => {
                if (code === 200) {
                  dataForm.weavRemark = data.greyInformation.weavingNote
                  for (let i = 0; i < data.yarnStructures.length; i++) {
                    datasList.value.push({
                      // colourNumber色号
                      // colorAccording色称
                      rawmaterialCode: data.yarnStructures[i].yarnCode
                        ? data.yarnStructures[i].yarnCode
                        : '',
                      rawmaterialName: data.yarnStructures[i].staple
                        ? data.yarnStructures[i].staple
                        : '',
                      yarnProportion: data.yarnStructures[i].yarnCountProportion
                        ? data.yarnStructures[i].yarnCountProportion
                        : '',
                      weaveLoss: data.yarnStructures[i].weavingDamage
                        ? data.yarnStructures[i].weavingDamage
                        : '',
                      colorCode: data.yarnStructures[i].colourNumber
                        ? data.yarnStructures[i].colourNumber
                        : '',
                      colorName: data.yarnStructures[i].colorAccording
                        ? data.yarnStructures[i].colorAccording
                        : '',
                      grade: data.yarnStructures[i].grade ? data.yarnStructures[i].grade : '',
                      yarnSource: data.yarnStructures[i].yarnSource
                        ? data.yarnStructures[i].yarnSource
                        : '',
                      yarnLength: data.yarnStructures[i].yarnLong
                        ? data.yarnStructures[i].yarnLong
                        : '',
                      yarnUnits: data.yarnStructures[i].yarnUnits
                        ? data.yarnStructures[i].yarnUnits
                        : '',
                    })
                  }
                  // tables.handleSuccess(datasList.value)
                  // gridOption3.value.setRowData(datasList.value)
                  tableDateList.value = datasList.value
                  // console.log(tableDateList.value);

                  tableDateList.value.forEach(async (cc: any, i: any) => {
                    let temp = await blurOrderWeight(cc, 1)
                    // console.log(cc.withYarnNum);
                    //  setTimeout(() => {
                    post({
                      url: 'planSingle/planOrder/getRawNumInfo',
                      data: {
                        rawmaterialName: tableDateList.value[i]
                          ? tableDateList.value[i].rawmaterialName
                          : '', //原料名称
                        rawmaterialCode: tableDateList.value[i]
                          ? tableDateList.value[i].rawmaterialCode
                          : '', //原料编号
                        withYarnNum: tableDateList.value[i].withYarnNum,
                        //配纱数量
                      },
                    }).then((Infores: any) => {
                      if (Infores.code == 200) {
                        cc.outboundNum = Infores.data.outboundNum
                        cc.backYarnNum = Infores.data.backYarnNum
                        cc.oweNum = Infores.data.ownNum
                      }
                    })
                    // }, 1000);
                  })
                  gridOption3.value.setRowData(tableDateList.value)
                  // 组织排针 数据
                  zzpzdata.value =
                    data.organizationPinSons.length == 0
                      ? [
                          {
                            upBasin: '',
                            belowBasin: '',
                            id: '',
                            pdOrganizationPinId: '',
                          },
                        ]
                      : data.organizationPinSons
                  // 裁口排针
                  if (data.cuttingMouthNeedleGrey != null) {
                    let cuttingMouthNeedleGrey = data.cuttingMouthNeedleGrey
                    ckpzobj.id = cuttingMouthNeedleGrey.id
                    ckpzobj.pinHeader = cuttingMouthNeedleGrey.pinHeader
                    ckpzobj.arrangement = cuttingMouthNeedleGrey.arrangement
                  }
                  //tw加
                  if (
                    data.cuttingMouthNeedleGrey != null &&
                    data.cuttingMouthNeedleGrey.length > 0
                  ) {
                    ckpzobj.pinHeader = data.cuttingMouthNeedleGrey[0].pinHeader
                    ckpzobj.arrangement = data.cuttingMouthNeedleGrey[0].arrangement
                    // ckpzid.value = data.cuttingMouthNeedleGrey[0].cmdName
                  }
                  // 排三角arrangementTriangleGreys
                  sjdata.sj = data.arrangementTriangleGreys.info
                  // sjdata.sjid=data.arrangementTriangleGreys.greyId
                  // psjpb.value=data.arrangementTriangleGreys.greyId 现有坯布
                  sjdata.atCode = data.arrangementTriangleGreys.atCode
                  sjdata.atName = data.arrangementTriangleGreys.atName
                  sjdata.remark = data.arrangementTriangleGreys.remark
                  psList.value = data.atOther
                } else {
                  Message.error('获取原料失败')
                }
              })
            }
          })
        } else {
          Message.error('获取失败')
        }
      })
    }
  }

  const zzpzdata = ref<any>()
  const sjdata: any = reactive<{ sj: any[] }>({ sj: [] })

  let isPbbh = ''
  const changes2 = (val: any) => {
    isPbbh = val
  }
  const changes3 = (val: any) => {
    if (isPbbh != '') {
      dataForm.greyBatchNo = isPbbh + '-' + val
    }
  }

  const orderWeights = (val: any) => {
    dataForm.pieceNum = Math.ceil(val / dataForm.pieceWeight)
    dataForm.amount = val * dataForm.price
  }

  const orderWeights1 = (val: any) => {
    dataForm1.orderChangeWeight = dataForm1.orderWeight + dataForm1.changeWeight
    dataForm1.pieceNum = Math.ceil(dataForm1.orderChangeWeight / dataForm1.pieceWeight)
    dataForm1.amount = dataForm1.orderChangeWeight * dataForm1.price
  }

  let bzYq: any = ref([])
  const isBz = () => {
    post({
      url: 'dict/dictTypeDetail/getListByCodeType?codeType=16',
    }).then((res: any) => {
      if (res.code == 200) {
        bzYq.value = res.data
      }
    })
  }
  let jgCxArray: any = ref([])
  const jgCx = (val: any) => {
    post({
      url: 'dict/dictTypeDetail/getListByCodeType?codeType=50',
      data: {
        rubberhoseName: val,
      },
    }).then((res: any) => {
      if (res.code == 200) {
        jgCxArray.value = res.data
      }
    })
  }
  const khmctList = ref<any[]>([])
  const khmctSelect = () => {
    post({
      url: 'purchase/Provider/getFieldValue',
      data: {
        providerName: '',
      },
    }).then(({ data, code }) => {
      if (code === 200) {
        khmctList.value = data
      }
    })
  }

  const ckmctList = ref<any[]>([])
  const ckmctSelect = (record: any) => {
    if (
      dataForm.outSouringCompanyId == '' ||
      dataForm.outSouringCompanyId == null ||
      dataForm.outSouringCompanyId == undefined
    ) {
      Message.error('请先选择加工单位')
      return
    }
    record.batch = ''
    post({
      url: 'product/Rawmaterial/getInfoByCode',
      data: {
        rawmaterialCode: record.rawmaterialCode,
        rawmaterialName: record.rawmaterialName,
      },
    }).then((res: any) => {
      if (res.code == 200) {
        for (let item in res.data) {
          record[item] = res.data[item]
        }
      } else {
        Message.error(res.message)
      }
    })
    post({
      url: 'wms/warehouse/getWarehouseByPara',
      data: {
        warehouseTypeName: '原纱仓',
        firmId: dataForm.outSouringCompanyId,
        virtuallyState: 0,
      },
    }).then(({ data, code }) => {
      if (code === 200) {
        ckmctList.value = data
      }
    })
  }

  const batchss = ref<any[]>([])
  const batchs = (val: any) => {
    if (val.warehouseName == '' || val.warehouseName == null || val.warehouseName == undefined) {
      Message.error('请先选择仓库')
      return
    }
    let wId: any
    ckmctList.value.forEach((item: any) => {
      if (item.warehouseName == val.warehouseName) {
        wId = item.id
      }
    })
    post({
      url: 'wms/yarnStock/getInfoByRawAndBatch',
      data: {
        warehouse_id: wId,
        yarn_code: val.rawmaterialCode,
        yarn_name: val.rawmaterialName,
      },
    }).then((res: any) => {
      batchss.value = res
    })
  }
  const levels2 = ref<any[]>([])
  const levels = (val: any) => {
    if (
      (val.batch == '' || val.batch == null || val.batch == undefined) &&
      (val.withYarnNum == '' || val.withYarnNum == null || val.withYarnNum == undefined)
    ) {
      Message.error('请先选择批次和配纱数量')
      return
    }
    let wId: any
    ckmctList.value.forEach((item: any) => {
      if (item.warehouseName == val.warehouseName) {
        wId = item.id
      }
    })
    post({
      url: 'wms/yarnStock/getInfoByBatch',
      data: {
        warehouse_id: wId,
        yarn_code: val.rawmaterialCode,
        yarn_name: val.rawmaterialName,
        batch: val.batch,
        withYarnNum: val.withYarnNum,
        // firmId: dataForm.outSouringCompanyId,
        // warehouseId: wId,
        // rawmaterialCode: val.rawmaterialCode,
        // batch: val.batch
      },
    }).then(({ data, code }) => {
      if (code === 200) {
        val.level = data.level
        val.colorName = data.colorName
        val.unit = data.unit
        val.oweNum = data.oweNum
        val.canDeliveryYarnNum = data.canDeliveryYarnNum
        val.yarnCard = data.yarnCard
        val.workBatchID = data.workBatchID
      }
    })
  }

  const cahngesBat = ($event: any, record: any) => {
    // let stosk;
    // ckmctList.value.forEach((item: any) => {
    //     if (item.warehouseName == val.warehouseName) {
    //         stosk = item.stockTableName
    //     }
    // })

    // post({
    //     url: 'wms/stock/needPlanOrder',
    //     data: {
    //         stockTableName: stosk,
    //         rawmaterialCode: '0001',
    //         batch: val.batch
    //     }
    // }).then(({ data, code }) => {
    //     if (code === 200) {
    //         for (let item in data[0]) {
    //             val[item] = data[0][item]
    //         }
    //         let adasd = ''
    //         datasList.value.forEach((item: any) => {
    //             adasd += '/' + item.yarnCard + item.batch
    //         })
    //         dataForm.yarnBatch = adasd.substring(1)
    //     }

    // })
    record.level = ''
    // let objA: any;
    // batchss.value.forEach((item: any) => {
    //     if ($event == item.batch) {
    //         objA = item
    //     }
    // })
    // for (let item in objA) {
    //     record[item] = objA[item]
    // }
  }
  const cahangess = ($event: any, record: any) => {
    let wId: any
    ckmctList.value.forEach((item: any) => {
      if (item.warehouseName == record.warehouseName) {
        wId = item.id
      }
    })
    post({
      url: 'wms/WarehousetypeFieldvalue/getPlannedOrderByStock',
      data: {
        firmId: dataForm.outSouringCompanyId,
        warehouseId: wId,
        rawmaterialCode: record.rawmaterialCode,
        batch: record.batch,
        level: $event,
      },
    }).then((res: any) => {
      if (res.code == 200) {
        let objA = res.data
        for (let item in objA) {
          record[item] = objA[item]
        }
      } else {
        Message.error(res.message)
      }
    })
  }

  const khmclist = ref([])
  const khmcSelect = (val: any) => {
    post({
      url: 'product/Brand/getFieldValue',
      data: {
        brandName: val,
      },
    }).then(({ data, code }) => {
      if (code === 200) {
        khmclist.value = data
      }
    })
  }

  const xingqingsju = (val: any) => {
    dataForm.widthState = Number(dataForm.widthState)
    pageData.sideTitle = '织布单详情'
    loadings.value = true
    pibuArray.pibu1 = val.greyBatchNo.split('-')[0]
    pibuArray.pibu2 = val.greyBatchNo.split('-')[1]
    post({
      url: 'planSingle/planOrder/getRawmaterialInfo',
      data: val.id,
    }).then(async (res: any) => {
      if (res.code == 200) {
        datasList = res.data
        await renderTableDateList(datasList)
      } else {
        Message.error('获取原料信息失败')
      }
    })
    post({
      url: 'planSingle/planOrderChange/getLikeList',
      data: { planOrderCode: val.planOrderCode },
    }).then((res: any) => {
      if (res.code == 200) {
        tableDateList2_1.value = res.data
      } else {
        Message.error(res.message)
      }
    })
    post({
      url: 'product/pdGreyInformation/selectpdGreyInformation',
      data: {
        grayFabricName: val.greyName,
      },
    }).then((res: any) => {
      if (res.code == 200) {
        // dataForm.widthState = Number(res.data[0].scutchingState)
        dataForm.widthState = Number(val.type)
        dataForm.weavRemark = res.data[0].weavingNote
        isDatasList.value = res.data
        jiTypes.value = res.data[0].machineType
        let idsDta
        let organizationPinId
        let arrangementId
        let cutMouthNeedleId
        isDatasList.value.forEach((res: any) => {
          if (res.greyCode == val.greyCode) {
            idsDta = res.id
            organizationPinId = res.organizationPinId
            arrangementId = res.arrangementId
            cutMouthNeedleId = res.cutMouthNeedleId
            dataForm.machineType = res.machineType
            dataForm.greyId = res.id
            post({
              url: 'product/pdGreyInformation/select',
              data: {
                id: idsDta,
              },
            }).then(({ code, data }) => {
              if (code === 200) {
                dataForm.productColthCode = data.greyInformation.popularizeCommodity
                dataForm.weavRemark = data.greyInformation.weavingNote
                // 组织排针 数据
                zzpzdata.value =
                  data.organizationPinSons.length == 0
                    ? [
                        {
                          upBasin: '',
                          belowBasin: '',
                          id: '',
                          pdOrganizationPinId: '',
                        },
                      ]
                    : data.organizationPinSons
                // 裁口排针
                if (data.cuttingMouthNeedleGrey != null) {
                  let cuttingMouthNeedleGrey = data.cuttingMouthNeedleGrey
                  ckpzobj.id = cuttingMouthNeedleGrey.id
                  ckpzobj.pinHeader = cuttingMouthNeedleGrey.pinHeader
                  ckpzobj.arrangement = cuttingMouthNeedleGrey.arrangement
                }
                //tw加
                if (data.cuttingMouthNeedleGrey != null && data.cuttingMouthNeedleGrey.length > 0) {
                  ckpzobj.pinHeader = data.cuttingMouthNeedleGrey[0].pinHeader
                  ckpzobj.arrangement = data.cuttingMouthNeedleGrey[0].arrangement
                  // ckpzid.value = data.cuttingMouthNeedleGrey[0].cmdName
                }
                // 排三角arrangementTriangleGreys
                sjdata.sj = data.arrangementTriangleGreys.info
                // sjdata.sjid=data.arrangementTriangleGreys.greyId
                // psjpb.value=data.arrangementTriangleGreys.greyId 现有坯布
                sjdata.atCode = data.arrangementTriangleGreys.atCode
                sjdata.atName = data.arrangementTriangleGreys.atName
                sjdata.remark = data.arrangementTriangleGreys.remark
                psList.value = data.atOther
              } else {
                Message.error('获取原料失败')
              }
            })
          }
        })
      } else {
        Message.error('获取失败')
      }
    })
    doRefreshs(val.id)
    setTimeout(() => {
      for (let item in val) {
        dataForm[item] = val[item]
        if (item == 'computeMode') {
          dataForm.computeMode = val['computeMode'] == 0 ? '条距' : '路数'
        }
      }
      loadings.value = false
      pageData.showAdd1 = true
    }, 100)
  }

  const xingqingsju1 = (val: any) => {
    dataForm.widthState = Number(dataForm.widthState)
    pageData.sideTitle = '修改织布单'
    loadings.value = true
    pibuArray.pibu1 = val.greyBatchNo.split('-')[0]
    pibuArray.pibu2 = val.greyBatchNo.split('-')[1]
    post({
      url: 'planSingle/planOrder/getRawmaterialInfo',
      data: val.id,
    }).then(async (res: any) => {
      if (res.code == 200) {
        datasList = res.data
        await renderTableDateList(datasList)
        // tableDateList.value = datasList
      } else {
        Message.error('获取原料信息失败')
      }
    })
    post({
      url: 'planSingle/planOrderChange/getLikeList',
      data: { planOrderCode: val.planOrderCode },
    }).then((res: any) => {
      if (res.code == 200) {
        tableDateList2_1.value = res.data
      } else {
        Message.error(res.message)
      }
    })
    post({
      url: 'product/pdGreyInformation/selectpdGreyInformation',
      data: {
        grayFabricName: val.greyName,
      },
    }).then((res: any) => {
      if (res.code == 200) {
        // dataForm.widthState = Number(res.data[0].scutchingState)
        dataForm.widthState = Number(val.type)
        dataForm.weavRemark = res.data[0].weavingNote
        isDatasList.value = res.data
        jiTypes.value = res.data[0].machineType
        let idsDta
        let organizationPinId
        let arrangementId
        let cutMouthNeedleId
        isDatasList.value.forEach((res: any) => {
          if (res.greyCode == val.greyCode) {
            idsDta = res.id
            organizationPinId = res.organizationPinId
            arrangementId = res.arrangementId
            cutMouthNeedleId = res.cutMouthNeedleId
            dataForm.machineType = res.machineType
            dataForm.greyId = res.id
            post({
              url: 'product/pdGreyInformation/select',
              data: {
                id: idsDta,
              },
            }).then(({ code, data }) => {
              if (code === 200) {
                dataForm.weavRemark = data.greyInformation.weavingNote
                // 组织排针 数据
                zzpzdata.value =
                  data.organizationPinSons.length == 0
                    ? [
                        {
                          upBasin: '',
                          belowBasin: '',
                          id: '',
                          pdOrganizationPinId: '',
                        },
                      ]
                    : data.organizationPinSons
                // 裁口排针
                if (data.cuttingMouthNeedleGrey != null) {
                  let cuttingMouthNeedleGrey = data.cuttingMouthNeedleGrey
                  ckpzobj.id = cuttingMouthNeedleGrey.id
                  ckpzobj.pinHeader = cuttingMouthNeedleGrey.pinHeader
                  ckpzobj.arrangement = cuttingMouthNeedleGrey.arrangement
                }
                //tw加
                if (data.cuttingMouthNeedleGrey != null && data.cuttingMouthNeedleGrey.length > 0) {
                  ckpzobj.pinHeader = data.cuttingMouthNeedleGrey[0].pinHeader
                  ckpzobj.arrangement = data.cuttingMouthNeedleGrey[0].arrangement
                  // ckpzid.value = data.cuttingMouthNeedleGrey[0].cmdName
                }
                // 排三角arrangementTriangleGreys
                sjdata.sj = data.arrangementTriangleGreys.info
                // sjdata.sjid=data.arrangementTriangleGreys.greyId
                // psjpb.value=data.arrangementTriangleGreys.greyId 现有坯布
                sjdata.atCode = data.arrangementTriangleGreys.atCode
                sjdata.atName = data.arrangementTriangleGreys.atName
                sjdata.remark = data.arrangementTriangleGreys.remark
                psList.value = data.atOther
              } else {
                Message.error('获取原料失败')
              }
            })
          }
        })
      } else {
        Message.error('获取失败')
      }
    })
    doRefreshs(val.id)
    setTimeout(() => {
      for (let item in val) {
        dataForm[item] = val[item]
        if (item == 'computeMode') {
          dataForm.computeMode = val['computeMode'] == 0 ? '条距' : '路数'
        }
      }
      loadings.value = false
      pageData.showAdd1 = true
    }, 100)
  }
  const guanbis = () => {
    //pageData.showAdd1 = false
    //doRefresh()
    sideOk()
  }

  const tags = [
    { id: '1', val: '̶' },
    { id: '2', val: 'Ո' },
    { id: '3', val: 'Ս' },
    { id: '4', val: 'Ʌ' },
    {
      id: '5',
      val: 'V',
    },
  ]

  const sideNo = () => {
    pageData.showAdd = false
    for (let item in dataForm) {
      dataForm[item] = ''
    }
    doRefresh()
  }
  const sideNos = () => {
    pageData.drawerLoading = true
    if (dataForm1.changeWeight < 0) {
      post({
        url: 'planSingle/planOrderChange/saveChangeInfo',
        data: {
          ...dataForm1,
          rawInfo: tableDateList_1.value,
        },
      })
        .then((res: any) => {
          if (res.code == 200) {
            user()
            let oa = res.data
            post({
              url: 'planSingle/planOrderChange/submitChangeInfoRemove',
              data: oa,
            }).then(({ data, code, message }) => {
              if (code === 200) {
                addLoding.value = false
                Message.success('提交成功')
                doRefresh()
                loadings.value = false
                dblclicksShowA2.value = false
                ChangeButtonVisible.value = false
                formRef.value?.resetFields()
                pageData.drawerLoading = false
                pibuArray.pibu1 = ''
                pibuArray.pibu2 = ''
              } else {
                Message.error(message)
                post({
                  url: 'planSingle/planOrderChange/delChangeInfo',
                  data: { id: oa.id },
                }).then((res: any) => {})
              }
            })
          } else {
            Message.error(res.message)
            addLoding.value = false
            loadings.value = false
            pageData.drawerLoading = false
          }
        })
        .finally(() => {
          loadings.value = false
        })
    } else {
      if (dataForm1.schedulState == 0 || dataForm1.changeWeight == 0) {
        post({
          url: 'planSingle/planOrderChange/saveChangeInfo',
          data: {
            ...dataForm1,
            rawInfo: tableDateList_1.value,
          },
        })
          .then((res: any) => {
            if (res.code == 200) {
              user()
              let oa = res.data
              post({
                url: 'planSingle/planOrderChange/submitChangeInfoAdd',
                data: {
                  id: oa.id,
                  infos: [],
                  addSave: 1,
                },
              })
                .then(({ data, code, message }) => {
                  if (code === 200) {
                    addLoding.value = false
                    Message.success('提交成功')
                    doRefresh()
                    loadings.value = false
                    dblclicksShowA2.value = false
                    ChangeButtonVisible.value = false
                    pageData.drawerLoading = false
                    formRef.value?.resetFields()
                    pibuArray.pibu1 = ''
                    pibuArray.pibu2 = ''
                  } else {
                    Message.error(message)
                    post({
                      url: 'planSingle/planOrderChange/delChangeInfo',
                      data: { id: oa.id },
                    }).then((res: any) => {})
                  }
                })
                .catch(() => {
                  post({
                    url: 'planSingle/planOrderChange/delChangeInfo',
                    data: { id: oa.id },
                  }).then((res: any) => {})
                })
            } else {
              Message.error(res.message)
              addLoding.value = false
              loadings.value = false
              pageData.drawerLoading = false
            }
          })
          .finally(() => {
            loadings.value = false
          })
      } else {
        post({
          url: 'planSingle/planMachineTask/getPageInfo',
          data: {
            page: 1,
            size: 1000,
            planOrderCode: dataForm1.planOrderCode,
          },
        }).then(({ data, code, message }) => {
          if (code === 200) {
            tcA2DataList.value = data.list
            dblclicksShowA2.value = true
            pageData.drawerLoading = false
          } else {
            Message.error(message)
          }
        })
      }
    }
  }
  const saveAdd = () => {
    let ob = tcA2DataList.value.map((item: any) => {
      return item.machineCode
    })
    post({
      url: '/planSingle/planOrderChange/getChangeMachineInfo',
      data: {
        machineCode: '',
        machineCodes: ob,
        machineType: machineTypeXZ.value,
      },
    }).then(({ data, code, message }) => {
      if (code === 200) {
        tcA3DataList.value = data
        dblclicksShowA3.value = true
      } else {
        Message.error(message)
      }
    })
  }

  const selectCx = () => {
    let ob = tcA2DataList.value.map((item: any) => {
      return item.machineCode
    })
    post({
      url: '/planSingle/planOrderChange/getChangeMachineInfo',
      data: {
        machineCode: machineCodeXZ.value,
        machineCodes: ob,
        machineType: machineTypeXZ.value,
      },
    }).then(({ data, code, message }) => {
      if (code === 200) {
        tcA3DataList.value = data
      } else {
        Message.error(message)
      }
    })
  }
  const dialogLoading = ref(false)
  const saveZjtA3 = () => {
    dialogLoading.value = true
    setTimeout(() => {
      try {
        let arr3 = gridOptionA3.value.getSelectedRows()
        let arr = tcA2DataList.value
        arr.forEach((item: any) => {
          arr3.push(item)
        })
        arr3.forEach((item: any) => {
          item.planOrderCode = dataForm1.planOrderCode
        })
        tcA2DataList.value = arr3
        dblclicksShowA3.value = false
        dialogLoading.value = false
      } catch (error) {
        dialogLoading.value = false
      }
    }, 500)
  }

  const saveZjt = () => {
    if (gridOptionA2.value.getSelectedRows().length === 0) {
      Message.error('请勾选数据')
      return
    }
    dialogLoading.value = true
    post({
      url: '/planSingle/planOrderChange/checkSubmitInfo',
      data: gridOptionA2.value.getSelectedRows(),
    }).then(({ data, code, message }) => {
      if (code === 200) {
        // 走保存提交模式
        post({
          url: 'planSingle/planOrderChange/saveChangeInfo',
          data: {
            ...dataForm1,
            rawInfo: tableDateList_1.value,
          },
        })
          .then((res: any) => {
            if (res.code == 200) {
              user()
              // dblclicksData.valeu = data
              let oa = res.data
              post({
                url: 'planSingle/planOrderChange/submitChangeInfoAdd',
                data: {
                  id: oa.id,
                  infos: gridOptionA2.value.getSelectedRows(),
                },
              })
                .then(({ data, code, message }) => {
                  if (code === 200) {
                    addLoding.value = false
                    Message.success('提交成功')
                    doRefresh()
                    loadings.value = false
                    dblclicksShowA2.value = false
                    pageData.drawerLoading = false
                    ChangeButtonVisible.value = false
                    formRef.value?.resetFields()
                    pibuArray.pibu1 = ''
                    pibuArray.pibu2 = ''
                    dialogLoading.value = false
                  } else {
                    Message.error(message)
                    post({
                      url: 'planSingle/planOrderChange/delChangeInfo',
                      data: { id: oa.id },
                    }).then((res: any) => {
                      dialogLoading.value = false
                    })
                  }
                })
                .catch(() => {
                  post({
                    url: 'planSingle/planOrderChange/delChangeInfo',
                    data: { id: oa.id },
                  }).then((res: any) => {
                    dialogLoading.value = false
                  })
                })
            } else {
              Message.error(res.message)
              addLoding.value = false
              loadings.value = false
              dialogLoading.value = false
            }
          })
          .finally(() => {
            loadings.value = false
          })
      } else {
        // 走弹窗模式
        dblclicksShowA4.value = true
        dblclicksText.value = message.split('!')
        dialogLoading.value = false
      }
    })
  }

  const saveZjt1 = () => {
    if (gridOptionA2.value.getSelectedRows().length === 0) {
      Message.error('请勾选数据')
      return
    }
    dialogLoading.value = true
    post({
      url: '/planSingle/planOrderChange/checkSubmitInfo',
      data: gridOptionA2.value.getSelectedRows(),
    }).then(({ data, code, message }) => {
      if (code === 200) {
        // 走保存提交模式
        post({
          url: 'planSingle/planOrderChange/submitChangeInfoAdd',
          data: {
            id: gridOption1.value.getSelectedRows()[0].id,
            infos: gridOptionA2.value.getSelectedRows(),
          },
        }).then(({ data, code, message }) => {
          if (code === 200) {
            Message.success('提交成功')
            getList()
            dblclicksShowA2.value = false
            dialogLoading.value = false
          } else {
            Message.error(message)
            dialogLoading.value = false
          }
        })
      } else {
        // 走弹窗模式
        dblclicksShowA4.value = true
        dblclicksText.value = message.split('!')
        dialogLoading.value = false
        // Message.error(message)
      }
    })
  }

  const saveZjtA4 = () => {
    post({
      url: 'planSingle/planOrderChange/saveChangeInfo',
      data: {
        ...dataForm1,
        rawInfo: tableDateList_1.value,
      },
    })
      .then((res: any) => {
        if (res.code == 200) {
          user()

          let oa = res.data
          post({
            url: 'planSingle/planOrderChange/submitChangeInfoAdd',
            data: {
              id: oa.id,
              infos: gridOptionA2.value.getSelectedRows(),
            },
          }).then(({ data, code, message }) => {
            if (code === 200) {
              dblclicksShowA2.value = false
              dblclicksShowA4.value = false
              ChangeButtonVisible.value = false
              addLoding.value = false
              Message.success('提交成功')
              doRefresh()
              loadings.value = false
              formRef.value?.resetFields()
              pibuArray.pibu1 = ''
              pibuArray.pibu2 = ''
            } else {
              Message.error(message)
              dblclicksShowA4.value = false
              post({
                url: 'planSingle/planOrderChange/delChangeInfo',
                data: { id: oa.id },
              }).then((res: any) => {})
            }
          })
        } else {
          Message.error(res.message)
          addLoding.value = false
          loadings.value = false
        }
      })
      .finally(() => {
        loadings.value = false
      })
  }

  let drawLoading = ref(false)
  const saveZjtA5 = () => {
    drawLoading.value = true
    post({
      url: 'planSingle/planOrderChange/submitChangeInfoAdd',
      data: {
        id: gridOption1.value.getSelectedRows()[0].id,
        infos: gridOptionA2.value.getSelectedRows(),
      },
    }).then(({ data, code, message }) => {
      if (code === 200) {
        dblclicksShowA2.value = false
        dblclicksShowA4.value = false
        drawLoading.value = false
        Message.success('提交成功')
        getList()
      } else {
        Message.error(message)
        dblclicksShowA4.value = false
        drawLoading.value = false
      }
    })
  }

  const handleReturnShow = ref(false)
  // 详情
  const handleReturn = (record: any) => {
    handleReturnShow.value = true
    post({
      url: 'planSingle/planOrderChange/getOrderChangeInfo',
      data: { changeId: record.id },
    }).then((res: any) => {
      if (res.code == 200) {
        let val = res.data
        loadings.value = true
        pibuArray.pibu1 = val.greyBatchNo.split('-')[0]
        pibuArray.pibu2 = val.greyBatchNo.split('-')[1]
        post({
          url: 'planSingle/planOrderChange/getRawmaterialChangeInfo',
          data: { planOrderId: val.id },
        }).then(async (res: any) => {
          if (res.code == 200) {
            datasList.value = res.data
            tableDateList_1.value = res.data
            await renderTableDateList(datasList.value)
            tableDateList_1.value.forEach((e: any) => {
              e['yarnUnits'] = e['yarnUnit']
            })
          } else {
            Message.error('获取原料信息失败')
          }
        })
        post({
          url: 'product/pdGreyInformation/selectpdGreyInformation',
          data: {
            grayFabricName: val.greyName,
          },
        }).then((res: any) => {
          if (res.code == 200) {
            // dataForm.widthState = Number(res.data[0].scutchingState)
            dataForm1.widthState = Number(val.type)
            dataForm1.weavRemark = res.data[0].weavingNote
            isDatasList.value = res.data
            jiTypes.value = res.data[0].machineType
            let idsDta
            let organizationPinId
            let arrangementId
            let cutMouthNeedleId
            isDatasList.value.forEach((res: any) => {
              if (res.greyCode == val.greyCode) {
                idsDta = res.id
                organizationPinId = res.organizationPinId
                arrangementId = res.arrangementId
                cutMouthNeedleId = res.cutMouthNeedleId
                dataForm1.machineType = res.machineType
                dataForm1.greyId = res.id
                post({
                  url: 'product/pdGreyInformation/select',
                  data: {
                    id: idsDta,
                  },
                }).then(({ code, data }) => {
                  if (code === 200) {
                    dataForm1.weavRemark = data.greyInformation.weavingNote
                    machineTypeXZ.value = data.greyInformation.machineType
                    // 组织排针 数据
                    zzpzdata.value =
                      data.organizationPinSons.length == 0
                        ? [
                            {
                              upBasin: '',
                              belowBasin: '',
                              id: '',
                              pdOrganizationPinId: '',
                            },
                          ]
                        : data.organizationPinSons
                    // 裁口排针
                    if (data.cuttingMouthNeedleGrey != null) {
                      let cuttingMouthNeedleGrey = data.cuttingMouthNeedleGrey
                      ckpzobj.id = cuttingMouthNeedleGrey.id
                      ckpzobj.pinHeader = cuttingMouthNeedleGrey.pinHeader
                      ckpzobj.arrangement = cuttingMouthNeedleGrey.arrangement
                    }
                    //tw加
                    if (
                      data.cuttingMouthNeedleGrey != null &&
                      data.cuttingMouthNeedleGrey.length > 0
                    ) {
                      ckpzobj.pinHeader = data.cuttingMouthNeedleGrey[0].pinHeader
                      ckpzobj.arrangement = data.cuttingMouthNeedleGrey[0].arrangement
                      // ckpzid.value = data.cuttingMouthNeedleGrey[0].cmdName
                    }
                    // 排三角arrangementTriangleGreys
                    sjdata.sj = data.arrangementTriangleGreys.info
                    // sjdata.sjid=data.arrangementTriangleGreys.greyId
                    // psjpb.value=data.arrangementTriangleGreys.greyId 现有坯布
                    sjdata.atCode = data.arrangementTriangleGreys.atCode
                    sjdata.atName = data.arrangementTriangleGreys.atName
                    sjdata.remark = data.arrangementTriangleGreys.remark
                    psList.value = data.atOther
                  } else {
                    Message.error('获取原料失败')
                  }
                })
              }
            })
          } else {
            Message.error('获取失败')
          }
        })
        doRefreshs(val.id)
        setTimeout(() => {
          cascaderRef2.value?.parentComponent({
            corporateId: val.verifyClothCompanyId,
          })
          for (let item in val) {
            dataForm1[item] = val[item]
            if (item == 'computeMode') {
              dataForm1.computeMode = val['computeMode'] == 0 ? '条距' : '路数'
            }
          }
          dataForm1.widthState = Number(val.type)
          checked.value = dataForm1['urgentState'] == 0 ? false : true
          checked2.value = dataForm1['tryYarnState'] == 0 ? false : true
          loadings.value = false
          dataForm1.orderChangeWeight = dataForm1.orderWeight + dataForm1.changeWeight
          dataForm1.amount = dataForm1.orderChangeWeight * dataForm1.price
          ChangeButtonVisible.value = true
          pageData.sideTitle = '织布单变更'
          nextTick(() => {
            cc(val)
          })
        }, 100)
      }
    })
  }
  const handleReturn1 = (record: any) => {
    handleReturnShow.value = true
    post({
      url: 'planSingle/planOrderChange/getOrderChangeInfo',
      data: { changeId: record.id },
    }).then((res: any) => {
      if (res.code == 200) {
        let val = res.data
        loadings.value = true
        pibuArray.pibu1 = val.greyBatchNo.split('-')[0]
        pibuArray.pibu2 = val.greyBatchNo.split('-')[1]
        post({
          url: 'planSingle/planOrderChange/getRawmaterialChangeInfo',
          data: { planOrderId: val.id },
        }).then(async (res: any) => {
          if (res.code == 200) {
            datasList.value = res.data
            tableDateList_1.value = res.data
            await renderTableDateList(datasList.value)
            tableDateList_1.value.forEach((e: any) => {
              e['yarnUnits'] = e['yarnUnit']
            })
          } else {
            Message.error('获取原料信息失败')
          }
        })
        post({
          url: 'product/pdGreyInformation/selectpdGreyInformation',
          data: {
            grayFabricName: val.greyName,
          },
        }).then((res: any) => {
          if (res.code == 200) {
            // dataForm1.widthState = Number(res.data[0].scutchingState)
            dataForm1.widthState = Number(val.type)
            dataForm1.weavRemark = res.data[0].weavingNote
            isDatasList.value = res.data
            jiTypes.value = res.data[0].machineType
            let idsDta
            let organizationPinId
            let arrangementId
            let cutMouthNeedleId
            isDatasList.value.forEach((res: any) => {
              if (res.greyCode == val.greyCode) {
                idsDta = res.id
                organizationPinId = res.organizationPinId
                arrangementId = res.arrangementId
                cutMouthNeedleId = res.cutMouthNeedleId
                dataForm1.machineType = res.machineType
                dataForm1.greyId = res.id
                post({
                  url: 'product/pdGreyInformation/select',
                  data: {
                    id: idsDta,
                  },
                }).then(({ code, data }) => {
                  if (code === 200) {
                    dataForm1.weavRemark = data.greyInformation.weavingNote
                    machineTypeXZ.value = data.greyInformation.machineType
                    // 组织排针 数据
                    zzpzdata.value =
                      data.organizationPinSons.length == 0
                        ? [
                            {
                              upBasin: '',
                              belowBasin: '',
                              id: '',
                              pdOrganizationPinId: '',
                            },
                          ]
                        : data.organizationPinSons
                    // 裁口排针
                    if (data.cuttingMouthNeedleGrey != null) {
                      let cuttingMouthNeedleGrey = data.cuttingMouthNeedleGrey
                      ckpzobj.id = cuttingMouthNeedleGrey.id
                      ckpzobj.pinHeader = cuttingMouthNeedleGrey.pinHeader
                      ckpzobj.arrangement = cuttingMouthNeedleGrey.arrangement
                    }
                    //tw加
                    if (
                      data.cuttingMouthNeedleGrey != null &&
                      data.cuttingMouthNeedleGrey.length > 0
                    ) {
                      ckpzobj.pinHeader = data.cuttingMouthNeedleGrey[0].pinHeader
                      ckpzobj.arrangement = data.cuttingMouthNeedleGrey[0].arrangement
                      // ckpzid.value = data.cuttingMouthNeedleGrey[0].cmdName
                    }
                    // 排三角arrangementTriangleGreys
                    sjdata.sj = data.arrangementTriangleGreys.info
                    // sjdata.sjid=data.arrangementTriangleGreys.greyId
                    // psjpb.value=data.arrangementTriangleGreys.greyId 现有坯布
                    sjdata.atCode = data.arrangementTriangleGreys.atCode
                    sjdata.atName = data.arrangementTriangleGreys.atName
                    sjdata.remark = data.arrangementTriangleGreys.remark
                    psList.value = data.atOther
                  } else {
                    Message.error('获取原料失败')
                  }
                })
              }
            })
          } else {
            Message.error('获取失败')
          }
        })
        doRefreshs(val.id)
        setTimeout(() => {
          cascaderRef2.value?.parentComponent({
            corporateId: val.verifyClothCompanyId,
          })
          for (let item in val) {
            dataForm1[item] = val[item]
            if (item == 'computeMode') {
              dataForm1.computeMode = val['computeMode'] == 0 ? '条距' : '路数'
            }
          }
          dataForm1.widthState = Number(val.type)
          checked.value = dataForm1['urgentState'] == 0 ? false : true
          checked2.value = dataForm1['tryYarnState'] == 0 ? false : true
          loadings.value = false
          ChangeButtonVisible.value = true
          dataForm1.orderChangeWeight = dataForm1.orderWeight + dataForm1.changeWeight
          dataForm1.amount = dataForm1.orderChangeWeight * dataForm1.price
          pageData.sideTitle = '织布单变更'
          nextTick(() => {
            cc(val)
          })
        }, 100)
      }
    })
  }
  const defaultColDef = {
    sortable: true,
    resizable: true,
    filter: true,
    // flex: 1
  }
  const sideNo1 = () => {
    pageData.showAdd1 = false
    for (let item in dataForm) {
      dataForm[item] = ''
    }
    doRefresh()
  }

  //当值改变带出其他值
  const blurOrderWeight = (ob: any, num: any) => {
    let yarnProportionList: any = 0
    let weaveLossList: any = 0
    //dataForm.orderWeight  指令重量  yarnProportion   weaveLoss  withYarnNum 配纱数量  useYarnNum 用纱数量

    for (let i = 0; i < tableDateList.value.length; i++) {
      if (
        tableDateList.value[i].yarnProportion != undefined &&
        tableDateList.value[i].yarnProportion != null &&
        tableDateList.value[i].yarnProportion != ''
      ) {
        yarnProportionList += tableDateList.value[i].yarnProportion
      }
      if (tableDateList.value[i].weaveLoss != undefined) {
        weaveLossList += tableDateList.value[i].weaveLoss
      }
    }

    if (parseInt(yarnProportionList) > 100) {
      yarnProportionList = 0
      Message.error('用纱比例不能大于100%')
      // console.log(tableDateList.value)
      tableDateList.value.forEach((item: any) => {
        item.yarnProportion = 0
      })
    }
    if (weaveLossList > 100) {
      weaveLossList = 0
      Message.error('织造损耗不能大于100%')
      tableDateList.value.forEach((item: any) => {
        item.weaveLoss = 0
      })
    }
    if (num === 1) {
      if (
        dataForm.orderWeight != '' &&
        ob.yarnProportion != undefined &&
        ob.weaveLoss != undefined
      ) {
        post({
          url: 'planSingle/planOrder/getGreyNumInfo',
          data: [
            {
              orderWeight: dataForm.orderWeight,
              yarnProportion: ob['yarnProportion'],
              weaveLoss: ob['weaveLoss'],
            },
          ],
        }).then(({ data, code, message }) => {
          if (code === 200) {
            // console.log(data)
            nextTick(() => {
              gridOption3.value.setRowData(tableDateList.value)
              ob.withYarnNum = data[0]['useYarnNum']
              ob.useYarnNum = data[0]['useYarnNum']
            })
          } else {
            Message.error(message)
          }
        })
      }
      return new Promise<void>((resolve, reject) => {
        setTimeout(() => {
          resolve(1)
        }, 500)
      })
    } else if (num === 2) {
      if (
        dataForm1.orderChangeWeight != '' &&
        ob.yarnProportion != undefined &&
        ob.weaveLoss != undefined
      ) {
        post({
          url: 'planSingle/planOrder/getGreyNumInfo',
          data: [
            {
              orderWeight: dataForm1.orderChangeWeight,
              yarnProportion: ob['yarnProportion'],
              weaveLoss: ob['weaveLoss'],
            },
          ],
        }).then(({ data, code, message }) => {
          if (code === 200) {
            // console.log(data)
            nextTick(() => {
              gridOption3.value.setRowData(tableDateList_1.value)
              ob.withYarnNum = data[0]['useYarnNum']
              ob.useYarnNum = data[0]['useYarnNum']
            })
          } else {
            Message.error(message)
          }
        })
      }
      return new Promise<void>((resolve, reject) => {
        setTimeout(() => {
          resolve(1)
        }, 500)
      })
    }
  }
  //获取欠数/出库数量/退纱数量
  const wynChange = (ob: any) => {
    console.log(ob)

    post({
      url: 'planSingle/planOrder/getRawNumInfo',
      data: {
        rawmaterialName: ob.rawmaterialName, //原料名称
        rawmaterialCode: ob.rawmaterialCode, //原料编号
        withYarnNum: ob.withYarnNum,
        //配纱数量
      },
    }).then((Infores: any) => {
      if (Infores.code == 200) {
        for (let index = 0; index < tableDateList.value.length; index++) {
          if (tableDateList.value[index].rawmaterialCode == ob.rawmaterialCode) {
            tableDateList.value[index].outboundNum = Infores.data.outboundNum
            tableDateList.value[index].backYarnNum = Infores.data.backYarnNum
            tableDateList.value[index].oweNum = Infores.data.ownNum
            break
          }
        }
        nextTick(() => {
          gridOption3.value.setRowData(tableDateList.value)
        })
      }
    })
  }

  const blurOrderWeights = (res: any) => {
    tableDateList.value.forEach((cc: any) => {
      blurOrderWeight(cc, 1)
    })
    gridOption3.value.setRowData(tableDateList.value)
  }
  const changeProcessType = () => {
    console.log(111111111111111111111)
    dataForm.IsTria = false
  }
  const blurOrderWeights1 = (res: any) => {
    tableDateList_1.value.forEach((cc: any) => {
      blurOrderWeight(cc, 2)
    })
    gridOption3.value.setRowData(tableDateList_1.value)
  }

  const firmGroupList = ref()
  // // 获取公司列表
  // const getFirmGroup = () => {
  //             get({
  //                 url: '/org/firmGroup/getTreeFirmGroup',
  //             }).then(({ code, data }) => {
  //                 if (code === 200) {
  //                     firmGroupList.value = data
  //                 }
  //             })
  //         }

  //         const changeZu = (val: any) => {
  //             if (val == "" || val == undefined || val == null) {
  //                 pageData.isShowYg = false
  //             } else {
  //                 pageData.isShowYg = true
  //             }
  //         }
  const outSouringCompanys = (val: any) => {
    // gsDatas.value.forEach((item: any) => {
    //     if (val == item.id) {
    //         dataForm['outSouringCompany'] = item.typeName == "" ? item.firmName : item.typeName + "-" + item.firmName
    //     }
    // })
  }
  const ckmctSelects = ($event: any) => {
    ckmctList.value.forEach((item: any) => {
      if ($event == item.id) {
        whCuselectName.value = item.warehouseName
      }
    })
  }
  const firmLists: any = ref([])
  const getFirmGroup = () => {
    // get({
    //     url: '/org/firmGroup/getTreeFirmGroup',
    // }).then(({ code, data }) => {
    //     if (code === 200) {
    //         firmLists.value = data
    //     }
    // })
  }
  const ygNameList: any = ref([])
  const getYgName = () => {
    post({
      url: 'org/employee/getList',
      data: {
        groupId: dataForm.businessDepartmentId,
      },
    }).then((res) => {
      if (res.code == 200) {
        ygNameList.value = res.data
      } else {
        Message.error({
          content: '查询员工名称失败',
          duration: 5000,
        })
      }
    })
  }
  const getFirmGroupsz = () => {
    dataForm.businessPerson = ''
  }
  const huiche = () => {
    doRefresh()
  }
  const localeText1: any = ref(localeText)
  const dingdanArrays: any = ref([])
  const ywArrays: any = ref([])
  const shArrays: any = ref([])
  const dingdanFun = () => {
    post({
      url: 'dict/dictTypeDetail/getListByCodeType?codeType=23',
    }).then((res: any) => {
      if (res.code == 200) {
        dingdanArrays.value = res.data
      }
    })
  }
  const ywFun = (val: any) => {
    post({
      url: 'planSingle/weaveOrderType/getDropValue',
      data: {
        weaveOrderType: val,
        processType: dataForm.processType,
      },
    }).then((res: any) => {
      if (res.code == 200) {
        ywArrays.value = res.data
      }
    })
  }
  const shFun = () => {
    post({
      url: 'dict/dictTypeDetail/getListByCodeType?codeType=22',
    }).then((res: any) => {
      if (res.code == 200) {
        shArrays.value = res.data
      }
    })
  }
  let tcA2: any[] = [
    {
      showRowGroup: 'hide_def',
      headerName: '',
      checkboxSelection: true,
      headerCheckboxSelection: true,
      pinned: 'left',
      width: 50,
      resizable: false,
      filter: false,
      sortable: false,
      minWidth: 50,
      maxWidth: 50,
      lockPosition: 'left',
    },
    {
      headerName: '织布单号',
      field: 'planOrderCode',
      pinned: 'fixed',
    },
    {
      headerName: '生产单号',
      field: 'weavingCode',
      pinned: 'fixed',
    },
    {
      headerName: '机台号',
      field: 'machineCode',
      pinned: 'fixed',
    },
    {
      headerName: '未生产重量',
      field: 'productWeight',
      pinned: 'fixed',
    },
    {
      headerName: '预计开始时间',
      field: 'startTime',
      pinned: 'fixed',
    },
    {
      headerName: '实际开始时间',
      field: 'actualStartTime',
      pinned: 'fixed',
    },
    {
      headerName: '预计完成时间',
      field: 'endTime',
      pinned: 'fixed',
    },
    {
      headerName: '实际完成时间',
      field: 'actualEndTime',
      pinned: 'fixed',
    },
    {
      headerName: '生产状态',
      field: 'productionState',
      slotName: 'productionState',
      width: 120,
      fixed: 'right',
      cellRenderer: {
        template: `<span>{{ a1 }}</span>`,
        setup(props: any) {
          return {
            a1:
              props.params.data.productionState == 0
                ? '等待'
                : props.params.data.productionState == 1
                ? '生产中'
                : props.params.data.productionState == 2
                ? '完成'
                : props.params.data.productionState == 3
                ? '暂停'
                : '',
          }
        },
      },
      filterParams: {
        valueFormatter: function (params: any) {
          return params.value == '0'
            ? '等待'
            : params.value == '1'
            ? '生产中'
            : params.value == '2'
            ? '完成'
            : params.value == '3'
            ? '暂停'
            : ''
        },
      },
    },
  ]
  let tcA3: any[] = [
    {
      showRowGroup: 'hide_def',
      headerName: '',
      checkboxSelection: true,
      headerCheckboxSelection: true,
      pinned: 'left',
      width: 50,
      resizable: false,
      filter: false,
      sortable: false,
      minWidth: 50,
      maxWidth: 50,
      lockPosition: 'left',
    },
    {
      headerName: '机台号',
      field: 'machineCode',
      pinned: 'fixed',
    },
    {
      headerName: '楼层',
      field: 'areaName',
      pinned: 'fixed',
    },
    {
      headerName: '针寸数',
      field: 'workDrum',
      pinned: 'fixed',
    },
    {
      headerName: '生产状态',
      field: 'machineState',
      slotName: 'machineState',
      width: 120,
      fixed: 'right',
      cellRenderer: {
        template: `<span>{{ a1 }}</span>`,
        setup(props: any) {
          return {
            a1:
              props.params.data.machineState == 0
                ? '未启动'
                : props.params.data.machineState == 1
                ? '待单'
                : props.params.data.machineState == 2
                ? '待纱'
                : props.params.data.machineState == 3
                ? '洗转机'
                : props.params.data.machineState == 4
                ? '运行'
                : props.params.data.machineState == 5
                ? '暂停'
                : props.params.data.machineState == 6
                ? '维修'
                : props.params.data.machineState == 7
                ? '保养'
                : '',
          }
        },
      },
      filterParams: {
        valueFormatter: function (params: any) {
          return params.value == '0'
            ? '未启动'
            : params.value == '1'
            ? '待单'
            : params.value == '2'
            ? '待纱'
            : params.value == '3'
            ? '洗转机'
            : params.value == '4'
            ? '运行'
            : params.value == '5'
            ? '暂停'
            : params.value == '6'
            ? '维修'
            : params.value == '7'
            ? '保养'
            : ''
        },
      },
    },
  ]
  const tableColumns1 = useTableColumn([
    {
      title: '仓库名称',
      key: 'warehouseName',
      dataIndex: 'warehouseName',
      slotName: 'warehouseName',
      width: 150,
    },
    {
      title: '供应商名称',
      key: 'supplierName',
      dataIndex: 'supplierName',
      // slotName: 'khmc',
      width: 150,
    },
    {
      title: '纱线单位',
      key: 'yarnUnits',
      dataIndex: 'yarnUnits',
      width: 150,
    },
    {
      title: '原料编号',
      key: 'rawmaterialCode',
      dataIndex: 'rawmaterialCode',
      width: 150,
    },
    {
      title: '原料名称',
      key: 'rawmaterialName',
      dataIndex: 'rawmaterialName',
      width: 150,
    },
    {
      title: '色号',
      key: 'colorCode',
      dataIndex: 'colorCode',
      width: 150,
    },
    {
      title: '色称',
      key: 'colorName',
      dataIndex: 'colorName',
      width: 150,
    },
    {
      title: '等级',
      key: 'level',
      dataIndex: 'level',
      width: 150,
      // slotName: 'level'
    },
    {
      title: '纱牌',
      key: 'yarnCard',
      dataIndex: 'yarnCard',
      width: 150,
    },
    {
      title: '纱批',
      key: 'batch',
      dataIndex: 'batch',
      width: 150,
      // slotName: 'batch'
    },
    {
      title: '是否外厂',
      key: 'outerFirmState',
      dataIndex: 'outerFirmState',
      width: 150,
      slotName: 'outerFirmState',
    },
    {
      title: '纸管',
      key: 'paperTube',
      dataIndex: 'paperTube',
      width: 150,
    },
    {
      title: '实际支数',
      key: 'actualYarnCount',
      dataIndex: 'actualYarnCount',
      width: 150,
    },
    // {
    //     title: "用纱",
    //     key: "useYarnNum",
    //     dataIndex: "useYarnNum",
    //     width: 150
    // },
    {
      title: '试纱',
      key: 'tryYarn',
      dataIndex: 'tryYarn',
      slotName: 'tryYarn',
      width: 150,
    },
    {
      title: '用纱比例',
      key: 'yarnProportion',
      dataIndex: 'yarnProportion',
      width: 150,
      slotName: 'yarnProportion',
    },
    {
      title: '织造损耗',
      key: 'weaveLoss',
      dataIndex: 'weaveLoss',
      width: 150,
      slotName: 'weaveLoss',
    },
    {
      title: '纱损',
      key: 'yarnLoss',
      dataIndex: 'yarnLoss',
      width: 150,
    },
    {
      title: '配纱数量(KG)',
      key: 'withYarnNum',
      dataIndex: 'withYarnNum',
      width: 150,
      slotName: 'withYarnNum',
    },
    {
      title: '理论数量(KG)',
      key: 'useYarnNum',
      dataIndex: 'useYarnNum',
      width: 150,
      slotName: 'useYarnNum',
    },
    {
      title: '可发纱量',
      key: 'canDeliveryYarnNum',
      dataIndex: 'canDeliveryYarnNum',
      width: 150,
    },
    {
      title: '单位',
      key: 'unit',
      dataIndex: 'unit',
      width: 150,
    },
    {
      title: '出库数量',
      key: 'outboundNum',
      dataIndex: 'outboundNum',
      width: 150,
    },
    {
      title: '退纱数量',
      key: 'backYarnNum',
      dataIndex: 'backYarnNum',
      width: 150,
    },
    {
      title: '欠数',
      key: 'oweNum',
      dataIndex: 'oweNum',
      width: 150,
    },
    // {
    //   title: '是否占用',
    //   key: 'takeUpState',
    //   dataIndex: 'takeUpState',
    //   width: 150,
    // },
    {
      title: '操作',
      key: 'sacTions',
      dataIndex: 'sacTions',
      slotName: 'sacTions',
      fixed: 'right',
      width: 100,
    },
  ])

  const tableColumns1No1:any = [
    // {
    //   headerName: '仓库名称',
    //   field: 'warehouseName',
    //   width: 150,
    // },

    {
      headerName: '供应商名称',
      field: 'supplierName',
      width: 150,
    },
    {
      headerName: '用纱代码',
      field: 'yarnSource',
      width: 150,
    },
    {
      headerName: '纱长',
      field: 'yarnLength',
      cellRenderer: (params: any) => {
            return "<span>" + params.value ? (Number(params.value)).toFixed(2) : '' + "</span>";
        },
      filterParams: {
      valueFormatter: function (params: any) {
        return "<span>" + params.value ? (Number(params.value)).toFixed(2) : '' + "</span>";
      },
    },
      width: 150,
    },
    {
      headerName: '纱线单位',
      field: 'yarnUnit',
      width: 150,
    },
    {
      headerName: '原料编号',
      field: 'rawmaterialCode',
      width: 150,
    },
    {
      headerName: '原料名称',
      field: 'rawmaterialName',
      width: 150,
    },
    {
      headerName: '色号',
      field: 'colorCode',
      width: 150,
    },
    {
      headerName: '色称',
      field: 'colorName',
      width: 150,
    },
    {
      headerName: '等级',
      field: 'level',
      width: 150,
      // slotName: 'level'
    },
    {
      headerName: '纱牌',
      field: 'yarnCard',
      width: 150,
    },
    {
      headerName: '纱批',
      field: 'batch',
      width: 150,
    },
    {
      headerName: '是否外厂',
      field: 'outerFirmState',
      width: 150,
      cellRenderer: {
        template: `
        <a-select size="mini" popup-container="html" class="bacClass" v-model="record.outerFirmState">
          <a-option :value="1">是</a-option>
          <a-option :value="0">否</a-option>
        </a-select>`,
        setup(props: any): any {
          return {
            record: props.params.data,
          }
        },
      },
    },
    {
      headerName: '纸管',
      field: 'paperTube',
      width: 150,
    },
    {
      headerName: '实际支数',
      field: 'actualYarnCount',
      width: 150,
    },
    // {
    //     title: "用纱",
    //     key: "useYarnNum",
    //     dataIndex: "useYarnNum",
    //     width: 150
    // },
    {
      headerName: '试纱',
      field: 'tryYarn',
      width: 150,
      cellRenderer: {
        template: `
        <a-select popup-container="html" class="bacClass" v-model="record.tryYarn">
          <a-option>面</a-option>
          <a-option>底</a-option>
          <a-option>面+底</a-option>
        </a-select>`,
        setup(props: any): any {
          return {
            record: props.params.data,
          }
        },
      },
    },
    {
      headerName: '用纱比例',
      field: 'yarnProportion',
      width: 150,
      cellRenderer: {
        template: `
        <a-input-number class="bacClass" v-if="
      dataForm.orderWeight != '' &&
      dataForm.orderWeight != undefined &&
      dataForm.orderWeight != null
                " @change="a" v-model="record.yarnProportion" :max="100" :min="0" :precision="2">
          <template #append> %</template>
        </a-input-number>
        <a-input-number class="bacClass" v-else disabled @change="a"
                        v-model="record.yarnProportion" :max="100" :min="0" :precision="2">
          <template #append> %</template>
        </a-input-number>
      `,
        setup(props: any): any {
          const a = () => {
            blurOrderWeight(props.params.data, 1)
          }
          return {
            record: props.params.data,
            dataForm,
            a,
          }
        },
      },
    },
    {
      headerName: '织造损耗',
      field: 'weaveLoss',
      width: 150,
      cellRenderer: {
        template: `
        <a-input-number v-if="
      dataForm.orderWeight != '' &&
      dataForm.orderWeight != undefined &&
      dataForm.orderWeight != null
                " class="bacClass" @change="a" v-model="record.weaveLoss" :max="100" :min="0"
                        :precision="2">
          <template #append> %</template>
        </a-input-number>
        <a-input-number v-else disabled class="bacClass" @change="a"
                        v-model="record.weaveLoss" :max="100" :min="0" :precision="2">
          <template #append> %</template>
        </a-input-number>
      `,
        setup(props: any): any {
          const a = () => {
            blurOrderWeight(props.params.data, 1)
          }
          return {
            record: props.params.data,
            dataForm,
            a,
          }
        },
      },
    },
    {
      headerName: '纱损',
      field: 'yarnLoss',
      width: 150,
    },
    {
      headerName: '配纱数量(KG)',
      field: 'withYarnNum',
      width: 150,
      cellRenderer: inputRender,
      valueFormatter: (params: any) => {
        return params.value ? parseFloat((params.value).toFixed(2)) : null
      },
      valueSetter: (params: any) => {
        if(params.newValue){
          params.data.withYarnNum = parseFloat((Number(params.newValue)).toFixed(2))
        post({
          url: 'planSingle/planOrder/getRawNumInfo',
          data: {
            rawmaterialName: params.data.rawmaterialName, //原料名称
            rawmaterialCode: params.data.rawmaterialCode, //原料编号
            withYarnNum: params.data.withYarnNum, //配纱数量
          },
        }).then((Infores: any) => {
          if (Infores.code == 200) {
            params.data.backYarnNum = Infores.data.backYarnNum
            params.data.oweNum = Infores.data.oweNum
            params.data.outboundNum = Infores.data.outboundNum
            return true
          }
        })
        }
        
      },
    },
    {
      headerName: '理论数量(KG)',
      field: 'useYarnNum',
      width: 150,
      cellRenderer: function (params:any) {
          return params.value ? parseFloat((Number(params.value)).toFixed(2)) : null
      },
    },
    {
      headerName: '可发纱量',
      field: 'canDeliveryYarnNum',
      width: 150,
    },
    {
      headerName: '单位',
      field: 'unit',
      width: 150,
    },
    {
      headerName: '出库数量',
      field: 'outboundNum',
      width: 150,
    },
    {
      headerName: '退纱数量',
      field: 'backYarnNum',
      width: 150,
    },
    {
      headerName: '欠数',
      field: 'oweNum',
      width: 150,
    },
    // {
    //   headerName: '是否占用',
    //   field: 'takeUpState',
    //   width: 150,
    // },
    {
      headerName: '操作',
      field: 'sacTions',
      width: 150,
      pinned: 'right',
      cellRenderer: {
        template: `<a-button size="mini" type="primary" shape="round" @click="a">库存</a-button>`,
        setup(props: any): any {
          const a = () => {
            selectWh(props.params.data)
          }
          return {
            a,
          }
        },
      },
    },
  ]

  const tableColumns1No2:any = [
    // {
    //   headerName: '仓库名称',
    //   field: 'warehouseName',
    //   width: 150,
    // },

    {
      headerName: '供应商名称',
      field: 'supplierName',
      width: 150,
    },
    {
      headerName: '用纱代码',
      field: 'yarnSource',
      width: 150,
    },
    {
      headerName: '纱长',
      field: 'yarnLength',
      cellRenderer: (params: any) => {
            return "<span>" + params.value ? (Number(params.value)).toFixed(2) : '' + "</span>";
        },
      filterParams: {
      valueFormatter: function (params: any) {
        return "<span>" + params.value ? (Number(params.value)).toFixed(2) : '' + "</span>";
      },
    },
      width: 150,
    },
    {
      headerName: '纱线单位',
      field: 'yarnUnit',
      width: 150,
    },
    {
      headerName: '原料编号',
      field: 'rawmaterialCode',
      width: 150,
    },
    {
      headerName: '原料名称',
      field: 'rawmaterialName',
      width: 150,
    },
    {
      headerName: '色号',
      field: 'colorCode',
      width: 150,
    },
    {
      headerName: '色称',
      field: 'colorName',
      width: 150,
    },
    {
      headerName: '等级',
      field: 'level',
      width: 150,
      // slotName: 'level'
    },
    {
      headerName: '纱牌',
      field: 'yarnCard',
      width: 150,
    },
    {
      headerName: '纱批',
      field: 'batch',
      width: 150,
    },
    {
      headerName: '是否外厂',
      field: 'outerFirmState',
      width: 150,
      cellRenderer: {
        template: `
        <a-select size="mini" popup-container="html" class="bacClass" v-model="record.outerFirmState" disabled>
          <a-option :value="1">是</a-option>
          <a-option :value="0">否</a-option>
        </a-select>`,
        setup(props: any): any {
          return {
            record: props.params.data,
          }
        },
      },
    },
    {
      headerName: '纸管',
      field: 'paperTube',
      width: 150,
    },
    {
      headerName: '实际支数',
      field: 'actualYarnCount',
      width: 150,
    },
    {
      headerName: '试纱',
      field: 'tryYarn',
      width: 150,
    },
    {
      headerName: '用纱比例',
      field: 'yarnProportion',
      width: 150,
    },
    {
      headerName: '织造损耗',
      field: 'weaveLoss',
      width: 150,
    },
    {
      headerName: '纱损',
      field: 'yarnLoss',
      width: 150,
    },
    {
      headerName: '配纱数量(KG)',
      field: 'withYarnNum',
      width: 150,
      cellRenderer: {
        template: `
        <a-input-number size="mini" class="bacClass" v-model="record.withYarnNum" :precision="2" v-if="isEader == '织布单变更'">
        </a-input-number>`,
        setup(props: any): any {
          let val = props.params.data.useYarnNum ? parseFloat((Number(props.params.data.useYarnNum)).toFixed(2)) : null
          props.params.data.withYarnNum = val
          return {
            val,
            record: props.params.data,
            isEader: pageData.sideTitle,
          }
        },
      },
    },
    {
      headerName: '理论数量(KG)',
      field: 'useYarnNum',
      width: 150,
      cellRenderer: function (params:any) {
          return params.value ? parseFloat((Number(params.value)).toFixed(2)) : null
      },
    },
    {
      headerName: '库存可用量',
      field: 'canDeliveryYarnNum',
      width: 150,
    },
    {
      headerName: '单位',
      field: 'unit',
      width: 150,
    },
    {
      headerName: '出库数量',
      field: 'outboundNum',
      width: 150,
    },
    {
      headerName: '退纱数量',
      field: 'backYarnNum',
      width: 150,
    },
    {
      headerName: '欠数',
      field: 'oweNum',
      width: 150,
    },
    // {
    //   headerName: '是否占用',
    //   field: 'takeUpState',
    //   width: 150,
    // },
    {
      headerName: '操作',
      field: 'sacTions',
      width: 150,
      pinned: 'right',
      cellRenderer: {
        template: `
        <a-button size="mini" type="info" shape="round" @click="a" :disabled="!ChangeButtonVisible">库存</a-button>`,
        setup(props: any): any {
          const a = () => {
            selectWh(props.params.data)
          }
          return {
            a,
            ChangeButtonVisible,
          }
        },
      },
    },
  ]

  const configCascader = ref<{}>({
    corporateWidth: '230px', //公司宽度
    sectorWidth: '150px', //部门宽度
    corporateRquired: true, //公司是否必填
    sectorRquired: false, //部门是否必填
    size: 'mini', //选择框大小'mini' | 'small' | 'medium' | 'large'
    corporateName: '加工单位', //公司label
    sectorName: '选择部门', //部门label
    cascaderShow: 'sector', //配置部门不显示
    corporateNameLabelWidth: '100px',
  })
  let cascaderRef2 = ref()
  const configCascader2 = ref<{}>({
    corporateWidth: '230px', //公司宽度
    sectorWidth: '180px', //部门宽度
    corporateRquired: true, //公司是否必填
    sectorRquired: false, //部门是否必填
    size: 'mini', //选择框大小'mini' | 'small' | 'medium' | 'large'
    corporateName: '验布单位', //公司label
    sectorName: '选择部门', //部门label
    cascaderShow: 'sector', //配置部门不显示
    corporateNameLabelWidth: '100px',
  })
  let cascaderRef3 = ref()
  const configCascader3 = ref<{}>({
    corporateWidth: '230px', //公司宽度
    corporateRquired: false, //公司是否必填
    sectorRquired: false, //部门是否必填
    size: 'small', //选择框大小'mini' | 'small' | 'medium' | 'large'
    corporateName: '公司', //公司label
    cascaderShow: 'sector', //配置部门不显示
    corporateNameLabelWidth: '100px',
  })

  const changeCascader = (data: any) => {
    const { corporateId, sectorId, sectorLabel, corporateLabel } = data
    dataForm.outSouringCompanyId = corporateId
    dataForm['outSouringCompany'] = corporateLabel
    if (dataForm.greyCode && dataForm.outSouringCompanyId) {
      renderTableDateList(datasList.value)
    }
  }
  const changeCascader2 = (data2: any) => {
    const { corporateId, sectorId, sectorLabel, corporateLabel } = data2
    dataForm.verifyClothCompanyId = corporateId
    dataForm.verifyClothCompany = corporateLabel
    console.log(dataForm.verifyClothCompanyId)
  }
  const changeCascader3 = (data3: any) => {
    const { corporateId, corporateLabel } = data3
    pageData.outSouringCompanyId = corporateId
    console.log(pageData.outSouringCompanyId, 'label', corporateLabel)
    // dataForm.verifyClothCompany = corporateLabel
  }

  //根据账号回显
  const user = () => {
    post({
      url: '/admin/acl/user/findUserToken',
    }).then((res) => {
      dataForm.processType = res.data.data.judgeGroup
      post({
        url: 'admin/acl/user/findUserToken',
        data: {
          name: res,
        },
      }).then((res: any) => {
        if (res.code === 200) {
          let data: any = {
            corporateId: res.data.data.firmId,
            corporateLabel: res.data.data.firmName,
          }
          changeCascader(data)
          cascaderRefRef.value?.parentComponent({
            corporateId: res.data.data.firmId,
          })
          changeCascader2({
            corporateId: res.data.data.firmId,
            corporateLabel: res.data.data.firmName,
          })
          cascaderRef2.value?.parentComponent({
            corporateId: res.data.data.empMap.companyId,
          })
        } else {
          Message.error({
            content: res.message,
            duration: 5000,
          })
        }
      })
    })
  }

  const state = () => {
    doRefresh()
  }

  const pagination2: any = reactive({
    total: 0,
    pageSize: 10,
    page: 1,
  })

  const PageSize2 = (e: any) => {
    pagination2.page = e
    wjYcList()
  }

  const change2 = (e: any) => {
    pagination2.pageSize = e
    wjYcList()
  }

  const visible: any = ref(false)

  const whCuselect: any = ref(null)
  const whCuselectName: any = ref()
  const yarnCodeCx: any = ref()
  const yarnNameCx: any = ref()
  const colorCodes: any = ref()
  const colorNames: any = ref()
  const recordWb: any = ref()

  const selectWh = (record: any) => {
    // console.log(dataForm.outSouringCompanyId)
    if (
      dataForm.outSouringCompanyId == '' ||
      dataForm.outSouringCompanyId == null ||
      dataForm.outSouringCompanyId == undefined
    ) {
      Message.warning('请先选择加工单位')
      return
    }
    if (
      dataForm.customName == '' ||
      dataForm.customName == null ||
      dataForm.customName == undefined
    ) {
      Message.warning('请先客户名称')
      return
    }
    yarnCodeCx.value = record.rawmaterialCode
    yarnNameCx.value = record.rawmaterialName
    colorCodes.value = record.colorCode
    colorNames.value = record.colorName
    recordWb.value = record
    tableDataList2.value = []
    whCuselect.value = null
    productionBatch.value = ''
    ckmctSelect(record)
    visible.value = true
  }
  const handleOk = async (num: any) => {
    if (gridOption2.value.getSelectedRows().length > 1) {
      Message.error('只能勾选一条数据')
      return false
    }
    if (gridOption2.value.getSelectedRows().length == 0) {
      Message.error('请勾选数据')
      return false
    }

    await nextTick(() => {
      recordWb.value.warehouseName = whCuselectName.value
      recordWb.value.warehouseId = whCuselect.value
      recordWb.value.yarnUnit = gridOption2.value.getSelectedRows()[0].unit //纱线单位
      recordWb.value.unit = gridOption2.value.getSelectedRows()[0].unit //单位
      recordWb.value.colorCode = gridOption2.value.getSelectedRows()[0].colorCode //色号
      recordWb.value.colorName = gridOption2.value.getSelectedRows()[0].colorName //色称
      recordWb.value.level = gridOption2.value.getSelectedRows()[0].level //等级
      recordWb.value.yarnCard = gridOption2.value.getSelectedRows()[0].yarnBrand //纱牌
      recordWb.value.batch = gridOption2.value.getSelectedRows()[0].productionBatch //纱批
      recordWb.value.canDeliveryYarnNum = gridOption2.value.getSelectedRows()[0].weightTotal //可发纱量
      recordWb.value.supplierName = gridOption2.value.getSelectedRows()[0].supplier //供应商
      recordWb.value.matchColor = gridOption2.value.getSelectedRows()[0].matchColor //可配色称
    })
    if (pageData.sideTitle == '织布单变更') {
      gridOption3.value.setRowData(tableDateList_1.value)
    } else {
      gridOption3.value.setRowData(tableDateList.value)
    }

    return true
  }
  const handleCancel = () => {
    visible.value = false
  }

  const productionBatch: any = ref('')
  const selectWhCz = () => {
    if (whCuselect.value == null || whCuselect.value == '') {
      Message.error('请选择仓库')
      return
    }
    pagination2.page = 1
    wjYcList()
  }

  const tableDataList2: any = ref([])

  const gridOption2 = ref()
  const gridReady2 = (params: any) => {
    gridOption2.value = params.api
  }
  const gridOption2_1 = ref()
  const gridReady2_1 = (params: any) => {
    gridOption2_1.value = params.api
  }

  const wjYcList = () => {
    post({
      url: 'wms/yarnStock/getPage',
      data: {
        page: pagination2.page,
        size: pagination2.pageSize,
        warehouse_id: whCuselect.value,
        yarn_code: yarnCodeCx.value,
        yarn_name: yarnNameCx.value,
        custom_name: dataForm.customName,
        color_code: colorCodes.value,
        color_name: colorNames.value,
        production_batch: productionBatch.value,
      },
    }).then((res: any) => {
      gridOption2.value.setRowData(res.data.list)
      pagination2.total = res.data.total
    })
  }
  const tableColumns2: any = [
    {
      showRowGroup: 'hide_def',
      headerName: '',
      checkboxSelection: true,
      headerCheckboxSelection: true,
      pinned: 'left',
      width: 50,
      resizable: false,
      filter: false,
      sortable: false,
      minWidth: 50,
      maxWidth: 50,
      lockPosition: 'left',
    },
    {
      headerName: '变更单号',
      field: 'planOrderCode',
      width: 150,
    },
    {
      headerName: '变更日期',
      field: 'createTime',
      width: 150,
    },
    {
      headerName: '变更人',
      field: 'createName',
      width: 150,
    },
    {
      headerName: '变更前指令重量',
      field: 'oldOrderWeight',
      width: 150,
    },
    {
      headerName: '变更后指令重量',
      field: 'newOrderWeight',
      width: 150,
    },
    {
      headerName: '变更前匹数',
      field: 'oldPieceNum',
      width: 150,
    },
    {
      headerName: '变更后匹数',
      field: 'totleNum',
      width: 150,
    },
    {
      headerName: '操作',
      field: 'act',
      width: 200,
      pinned: 'right',
      cellRenderer: {
        template: `
      <a-space><el-button style="color:#165dff;" link @click="a">详情</el-button></a-space>`,
        setup(props: any): any {
          const a = () => {
            handleReturn(props.params.data)
          }
          return {
            a,
          }
        },
      },
    },
  ]
  const tc2: any = [
    {
      showRowGroup: 'hide_def',
      headerName: '',
      checkboxSelection: true,
      headerCheckboxSelection: true,
      pinned: 'left',
      width: 50,
      resizable: false,
      filter: false,
      sortable: false,
      minWidth: 50,
      maxWidth: 50,
      lockPosition: 'left',
    },
    {
      headerName: '公司',
      field: 'firm',
      // pinned: o['fixed'],
      width: 150,
    },
    {
      headerName: '仓库名称',
      field: 'warehouse',
      width: 150,
    },
    {
      headerName: '供应商名称',
      field: 'supplier',
      width: 150,
    },
    {
      headerName: '客户名称',
      field: 'customName',
      width: 150,
    },
    {
      headerName: '原料编号',
      field: 'yarnCode',
      width: 150,
    },
    {
      headerName: '原料名称',
      field: 'yarnName',
      width: 150,
    },
    {
      headerName: '纱牌',
      field: 'yarnBrand',
      width: 150,
    },
    {
      headerName: '纱批',
      field: 'productionBatch',
      width: 150,
    },
    {
      headerName: '等级',
      field: 'level',
      width: 150,
    },
    {
      headerName: '可配色称',
      field: 'matchColor',
      width: 150,
    },
    {
      headerName: '色号',
      field: 'colorCode',
      width: 150,
    },
    {
      headerName: '色称',
      field: 'colorName',
      width: 150,
    },
    {
      headerName: '整件/件数',
      field: 'pieceNumber',
      width: 150,
    },
    {
      headerName: '整件/件重',
      field: 'pieceWeight',
      width: 150,
    },
    {
      headerName: '散件/件数',
      field: 'bulkNumber',
      width: 150,
    },
    {
      headerName: '散件/散重',
      field: 'bulkWeight',
      width: 150,
    },
    {
      headerName: '总数量',
      field: 'weightTotal',
      width: 150,
    },
    {
      headerName: '单位',
      field: 'unit',
      width: 150,
    },
    {
      headerName: '库位',
      field: 'location',
      width: 150,
    },
    {
      headerName: '备注',
      field: 'remark',
      width: 150,
    },
  ]

  const completes = () => {
    if (gridOption.value.getSelectedRows().length === 0) {
      Message.error('请先勾选')
      return
    }
    let arr = gridOption.value.getSelectedRows()
    if (
      arr.some((item: any) => {
        return item.schedulState == 4
      })
    ) {
      Message.error('订单完结不能再次完结')
      return
    }
    ElMessageBox.confirm('确认勾选的计划单完成', '提示', {
      confirmButtonText: '确认',
      cancelButtonText: '取消',
    })
      .then(() => {
        pageData.pageLoading = true
        post({
          url: 'planSingle/planOrder/orderFinish',
          data: gridOption.value.getSelectedRows().map((res: any) => {
            return res.id
          }),
        }).then((res: any) => {
          if (res.code === 200) {
            doRefresh()
            Message.success('已完成')
            pageData.pageLoading = false
            // gridOption.value.getSelectedRows = []
          } else {
            Message.error(res.message)
            pageData.pageLoading = false
          }
        })
      })
      .catch(() => {})
  }

  import { pagingList } from '@/api/paging'
  import filedownload from 'js-file-download'

  const pagingList1: any = ref(pagingList)

  const BGvisible = ref(false)
  const ZBvisible = ref(false)
  let idList: any = ref([])
  let idList2: any = ref([])
  let idList5: any = ref([])
  const idList4: any = reactive<{ sj: any[] }>({ sj: [] })
  const BGhandleOk = () => {
    printJS({
      printable: 'Weaving',
      type: 'html',
      targetStyles: ['*'],
    })
  }
  const machineTypeXZ = ref('')
  const BGprint = () => {
    if (gridOptionyasda.value.getSelectedRows().length === 0) {
      Message.error('请勾选数据!')
      return
    }
    if (gridOptionyasda.value.getSelectedRows().length > 1) {
      Message.error('只能勾选一条数据!')
      return
    }
    post({
      url: '/planSingle/planOrder/getChangDY',
      data: {
        id: gridOptionyasda.value.getSelectedRows()[0].id,
        planOrderCode: gridOptionyasda.value.getSelectedRows()[0].planOrderCode,
        orderWeight: gridOptionyasda.value.getSelectedRows()[0].orderWeight,
        // id: "306"
      },
    }).then(({ code, data }: any) => {
      if (code == 200) {
        idList.value = data
        idList2.value = data[0].por
        dataForm.machineType = data[0].machineType
        post({
          url: 'product/pdGreyInformation/select',
          data: {
            id: data[0].greyId,
          },
        }).then(({ code, data }) => {
          if (code === 200) {
            dataForm.weavRemark = data.greyInformation.weavingNote
            // 组织排针 数据
            zzpzdata.value =
              data.organizationPinSons.length == 0
                ? [
                    {
                      upBasin: '',
                      belowBasin: '',
                      id: '',
                      pdOrganizationPinId: '',
                    },
                  ]
                : data.organizationPinSons
            // 裁口排针
            if (data.cuttingMouthNeedleGrey != null) {
              let cuttingMouthNeedleGrey = data.cuttingMouthNeedleGrey
              ckpzobj.id = cuttingMouthNeedleGrey.id
              ckpzobj.pinHeader = cuttingMouthNeedleGrey.pinHeader
              // ckpzobj.arrangement = cuttingMouthNeedleGrey.arrangement;
            }
            if (data.cuttingMouthNeedleGrey != null && data.cuttingMouthNeedleGrey.length > 0) {
              ckpzobj.pinHeader = data.cuttingMouthNeedleGrey[0].pinHeader
              ckpzobj.arrangement = data.cuttingMouthNeedleGrey[0].arrangement
            }
            // 排三角arrangementTriangleGreys
            idList4.sj = data.arrangementTriangleGreys.info
            idList4.atCode = data.arrangementTriangleGreys.atCode
            idList4.atName = data.arrangementTriangleGreys.atName
            idList5.value = data.cuttingMouthNeedleGrey
          }
        })
        BGvisible.value = true
      }
    })
  }

  let isDatasShuju: any = reactive({
    grey: [{}],
    planOrderRawmaterials: [{}],
    machineStandard: [{}],
  })
  const ZBhandleOk = () => {
    printJS({
      printable: 'order',
      type: 'html',
      targetStyles: ['*'],
    })
  }
  const ZBprint = async () => {
    if (gridOption.value.getSelectedRows().length === 0) {
      Message.error('请先勾选数据!')
      return
    }

    post({
      url: 'planSingle/planOrder/printShippingData',
      data: gridOption.value.getSelectedRows(),
      responseType: 'blob',
    }).then((zzx: any) => {
      let reader = new FileReader()
      reader.readAsDataURL(zzx)
      reader.onload = function () {
        let pdfBase64 = reader.result.replace('data:application/pdf;base64,', '')
        printJS({ printable: pdfBase64, type: 'pdf', base64: true })
      }
    })
  }
  const zbtzdDjs = async () => {
    if (gridOption.value.getSelectedRows().length === 0) {
      Message.error('请先勾选数据!')
      return
    }

    post({
      url: 'planSingle/planOrder/printShippingDataOld',
      data: gridOption.value.getSelectedRows(),
      responseType: 'blob',
    }).then((zzx: any) => {
      let reader = new FileReader()
      reader.readAsDataURL(zzx)
      reader.onload = function () {
        let pdfBase64 = reader.result.replace('data:application/pdf;base64,', '')
        printJS({ printable: pdfBase64, type: 'pdf', base64: true })
      }
    })
  }

  // /planSingle/planOrder/getListDY
  //打印预览PDF
  const printPdf = () => {
    if (gridOptionyasda.value.getSelectedRows().length === 0) {
      Message.error('请勾选数据!')
      return
    }
    // if (gridOptionyasda.value.getSelectedRows().length > 1) {
    //   Message.error('只能勾选一条数据!')
    //   return
    // }

    console.log('id' + gridOptionyasda.value.getSelectedRows()[0].id)
    console.log('planOrderCode' + gridOptionyasda.value.getSelectedRows()[0].planOrderCode)
    console.log('orderWeight' + gridOptionyasda.value.getSelectedRows()[0].orderWeight)
    post({
      url: '/planSingle/planOrder/getChangDY',
      data: {
        id: gridOptionyasda.value.getSelectedRows()[0].id,
        planOrderCode: gridOptionyasda.value.getSelectedRows()[0].planOrderCode,
        orderWeight: gridOptionyasda.value.getSelectedRows()[0].orderWeight,
      },
    }).then((res: any) => {
      if (res.code == 200) {
        let list = ref<any>(res.data)
        post({
          url: '/product/pdGreyInformation/select',
          data: {
            id: res.data.greyId,
          },
        }).then(({ data, code }: any) => {
          if (code == 200) {
            dataForm.weavRemark = data.greyInformation.weavingNote
            // dataForm.weavRemark = data.greyInformation.weavingNote
            selectedRow.value[0]['planId'] = list.value.por[0].planOrderId
            post({
              url: '/planSingle/planOrder/getListDY',
              // data: { ...res.data, ...data, arrangementTriangleGreys: data.arrangementTriangleGreys.info },
              data: selectedRow.value,
              responseType: 'blob',
            }).then((res: any) => {
              console.log('lllllllllllllllllllllllllllllllllllllllllllllllllll')
              console.log(list.value.por[0].planOrderId)
              console.log(selectedRow.value)
              let reader = new FileReader()
              reader.readAsDataURL(res)
              reader.onload = function () {
                let pdfBase64 = reader.result.replace('data:application/pdf;base64,', '')
                printJS({ printable: pdfBase64, type: 'pdf', base64: true })
              }
            })
          }
        })
      }
    })
  }

  const printBgds = () => {
    console.log('999')

    if (gridOptionyasda.value.getSelectedRows().length === 0) {
      Message.error('请勾选数据!')
      return
    }
    // if (gridOptionyasda.value.getSelectedRows().length > 1) {
    //   Message.error('只能勾选一条数据!')
    //   return
    // }

    console.log('id' + gridOptionyasda.value.getSelectedRows()[0].id)
    console.log('planOrderCode' + gridOptionyasda.value.getSelectedRows()[0].planOrderCode)
    console.log('orderWeight' + gridOptionyasda.value.getSelectedRows()[0].orderWeight)
    post({
      url: '/planSingle/planOrder/getChangDY',
      data: {
        id: gridOptionyasda.value.getSelectedRows()[0].id,
        planOrderCode: gridOptionyasda.value.getSelectedRows()[0].planOrderCode,
        orderWeight: gridOptionyasda.value.getSelectedRows()[0].orderWeight,
      },
    }).then((res: any) => {
      if (res.code == 200) {
        let list = ref<any>(res.data)
        post({
          url: '/product/pdGreyInformation/select',
          data: {
            id: res.data.greyId,
          },
        }).then(({ data, code }: any) => {
          if (code == 200) {
            dataForm.weavRemark = data.greyInformation.weavingNote
            // dataForm.weavRemark = data.greyInformation.weavingNote
            selectedRow.value[0]['planId'] = list.value.por[0].planOrderId
            post({
              url: '/planSingle/planOrder/getListDY2',
              // data: { ...res.data, ...data, arrangementTriangleGreys: data.arrangementTriangleGreys.info },
              data: selectedRow.value,
              responseType: 'blob',
            }).then((res: any) => {
              console.log('lllllllllllllllllllllllllllllllllllllllllllllllllll')
              console.log(list.value.por[0].planOrderId)
              console.log(selectedRow.value)
              let reader = new FileReader()
              reader.readAsDataURL(res)
              reader.onload = function () {
                let pdfBase64 = reader.result.replace('data:application/pdf;base64,', '')
                printJS({ printable: pdfBase64, type: 'pdf', base64: true })
              }
            })
          }
        })
      }
    })
  }
  const { saveGridState: saveGridState01, updateGridState: updateGridState01 } =
    saveOrUpdateGridState01('newschedulelist-1', gridOption, colState, tc)
  const onColumnMoved = () => {
    saveGridState01()
  }
  const onColumnResized = () => {
    saveGridState01()
  }
  const onColumnVisible = () => {
    saveGridState01()
  }
  const { saveGridState: saveGridState02, updateGridState: updateGridState02 } =
    saveOrUpdateGridState02('newschedulelist-2', gridOption1, colState2, Columns)
  const onColumnMoved2 = () => {
    saveGridState02()
  }
  const onColumnResized2 = () => {
    saveGridState02()
  }
  const onColumnVisible2 = () => {
    saveGridState02()
  }
  const { saveGridState: saveGridState03, updateGridState: updateGridState03 } =
    saveOrUpdateGridState03('newschedulelist-3', gridOptionyasda, colState3, Columns1)
  const onColumnMoved3 = () => {
    saveGridState03()
  }
  const onColumnResized3 = () => {
    saveGridState03()
  }
  const onColumnVisible3 = () => {
    saveGridState03()
  }
  const { saveGridState: saveGridState04, updateGridState: updateGridState04 } =
    saveOrUpdateGridState04('newschedulelist-4', gridReady3, colState3, tableColumns1No1)
  const onColumnMoved4 = () => {
    saveGridState04()
  }
  const onColumnResized4 = () => {
    saveGridState04()
  }
  const onColumnVisible4 = () => {
    saveGridState04()
  }

  const exportAll = () => {
    post({
      url: 'planSingle/planOrder/excelAllPlanOrder',
      data: {
        deleteState: 0,
        weaveCode: pageData.zxXh,
        planOrderCode: pageData.jhXh,
        customOrderNo: pageData.pbXh,
        customName: pageData.bmXh,
        businessPerson: pageData.ywy,
        auditState: pageData.shZt,
        orderType: 0,
      },
      responseType: 'blob',
    }).then((res) => {
      filedownload(res, '织布单列表.xlsx')
    })
  }

  emitter.on('setingSaxq', (data) => {
    xingqingsju(data)
  })
</script>

<style lang="less" scoped>
  .isyouUtyrer {
    width: 50%;
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
  }

  .thead {
    white-space: nowrap;
    justify-content: center;

    .th {
      // padding: 5px;
      box-sizing: border-box;
      text-align: center;
      display: inline-block;
    }

    width: 100%;
    text-align: left;
  }

  .tbody {
    white-space: nowrap;
    justify-content: center;

    .td {
      text-align: center;
      padding: 3px;
      box-sizing: border-box;
      display: inline-block;
    }

    text-align: left;
  }

  .trow > div {
    display: inline-block;
    text-align: center;
  }

  .active {
    width: 60px !important;
  }

  :deep(.ag-cell) {
    border-right: 1px solid #dde2eb;
  }

  :deep(.ag-header-cell) {
    border-right: 1px solid #dde2eb;
  }

  :deep(.arco-collapse) {
    border: none;
  }

  :deep(.arco-input-wrapper) {
    background-color: white !important;
  }

  .jth {
    margin: 30px 0;
    font-weight: 600;
  }

  .isTable {
    margin-top: 100px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
    border-collapse: collapse;
    border: 1px solid #ccc;

    td {
      border: 1px solid #ccc;
    }
  }

  .isTable3 {
    margin-top: 100px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
    border-collapse: collapse;
    border-bottom: 1px solid #ccc;
    border-right: 1px solid #ccc;
  }

  .isZbous {
    width: 800px;
    // margin-left: 15px;
    margin: 0;
    padding: 0;
    margin: 0 auto;
    zoom: 0.7;

    .isZbouss {
      width: 100%;
      text-align: center;
      font-size: 24px;
      font-weight: 600;
    }

    .isZbouss1 {
      width: 100%;
      display: flex;
      justify-content: space-between;
      font-size: 16px;
      font-weight: 600;

      .isZbouss1-1 {
        font-size: 22px;
        font-weight: 600;
      }
    }

    .isZbouss2 {
      width: 70%;
      display: flex;
      justify-content: space-between;
      font-size: 16px;
      font-weight: 600;
    }
  }

  .footers {
    width: 100%;
    margin: 0 auto;

    div {
      display: flex;
      justify-content: space-between;
      font-size: 16px;
    }
  }
</style>
